I never thought about or devoted much mental energy to child rapists until I became older and discovered just how bad and pervasive it was.
So your prescription rings false in my own experience.
That said, punishment is only part of the equation. Improving the well being and health of the society also is essential in reducing these types of crimes.
Physically eliminating and sending a message that these crimes especially will be dealt with sternly will go a long ways towards stopping future assaults. Many victims of these assaults later grow up to become victimizers themselves.