You have, what I call, moments of "existential freedom." That is, you subconsciously have come to realize that you are utterly free to do whatever the hell you want to do, including immoral acts: such as molest children.
Now that you've realized you have this freedom you simply need to choose not to act upon your desire to molest. The desire itself is something rather uncontrollable, but your decision to act upon it is definitely within your power. So long as you continue to abstain from acting upon that desire then you will remain moral and, one day, the desire itself may completely vanish.
Trust me, it is a VERY GOOD sign that you feel immediately disgusted by your desire to molest a child. The fact that you feel disgusted shows that your moral faculties are well in order.
This "realization of my existential freedom" has also hit me at odd times in my life, for example:
I am afraid of heights because I've always been so sure that I would jump if given the chance. Not that I'm suicidal or anything, I just would jump. I don't really know why.
I also have had these really, really strong urges to stand up and start screaming swear words during plays/musicals that I've been to, as well as this funeral I was at when I was in elementary school. Again, I knew it was weird and wrong, and I didn't want to do it, but this one part of my body was strongly urging me to act on that desire. Luckily I was able to repress it every time.
These urges are something natural, and they are evidence of your own realization that you are truly a free being; that morals are not metaphysical constraints, but only ethical ones. In other words, just because you shouldn't steal doesn't mean you can't. There are lots of things you CAN do, but many of those things you shouldn't do, because they are wrong.
Sometimes your mind will subconsciously wander into dangerous desires; it will tempt fate and explore interesting and exciting possibilities. Molestation is one such possibility, one such tempt of fate, one such dangerous idea. Just remember that you are in complete control of your own actions and all you have to do is continue to not act on that desire, no matter the situation.
This is how one learns self-control, not by denying that dangerous desires exist, but by confronting them head on and overcoming them. I'm sure you'll pull through!
If you have any questions or want me to clarify something then feel free to ask.