Well, I have heard that some sects in Hinduism think monks becoming eunuch will rid a person of sexual depravities. I do not think it works that way.
Well, yoga is a physical exercise and mental control, and is not necessarily associated with religion. I am sort of lukewarm towards the physical exercise idea (I would prefer a gym), but IMHO, it is real good for mental control.
It does not rid people of "sexual depravity".
What it does rid them of is a great deal of the biological goad to seek sexual fulfillment, particularly with other people. In this way, it can rid acts of sexual
stupidity performed through
biologically driven sexual desperation.
I think the "sinners in the hands of an angry God" thread outlines my thoughts through hyperbolic inverse as befits the "depravity" part.
Humans are literally goaded to need sex, or else become progressively more deranged, especially from testosterone. This is what castration removes, in addition to various stuff geared towards fulfilling such deranged notions.
There is a Big Mouth episode "No Nut November" that, in all its gloriousness fucked-up-ness captures this "depravity" in full, animated, color.
Once someone has, in their sexual derangement, convinced themselves utterly that black is white, up is down, and children can consent to sex, though, permanent damage has been done. Even if they are castrated, while castration might help them to not feel
a biological pressure to do so, they may very well still have the psychological desire to rape children, and they do still have the ability.
So you are right in that respect, of what castration cannot remove. It can remove progressive derangement, or at least reduce it, but it cannot remove evil belief.