It would improve the safety of children if somebody who has sexual attraction of minors could go to their doctor and admit to that and volunteer for chemical castration and ongoing counseling and monitoring.
Some people's brains are wired that way. It doesn't excuse them acting on that impulse but they need help to control it.
Anybody who does assault a child should not be released until they submit to castration, chemical or physical.