I did not grow up in a religious household at all. I can count on two hands the number of times I was in a Church or Synagogue before I was an adult. A few Catholic confirmations, an Episcopal confirmation, three bar mitzvahs and one bat mitzvah. Once or twice maybe I went to church after staying over at a friend's house for the weekend.
Considering that back then Catholics still said Mass in Latin, bar mitzvahs were conducted mostly in Hebrew, I didn't really understand most of what was happening and was more into the party afterwards.
So, I've always separated being "spiritual" versus being "religious". I know that for many the two are fused and can't be untied. But for me, I say take a sword to that Gordian knot and differentiate between the spiritual and the religious.
A friend of mine says that religion is for people afraid of going the hell and spirituality is for people that have already been there. I know what he means.
Many of the world's religions do have prohibitions against masturbation. The Abrahamic religions (Judaism, Christianity and Islam) take the prohibition from the sin of Onan (Gen 38:8 (
http://biblehub.com/genesis/38-8.htm)). But, when read, Onan's "sin", was not masturbation. Onan's brother died without producing an heir with his wife. Onan, under Jewish Law, was required to have sex with his sister in law to give her a child. This child would be raised as Onan's nephew and recognized as Onan's dead brother's child. Onan had sex with his sister in law, but pulled out and ejaculated on the ground.
For not completing intercourse with his sister in law, God struck Onan dead. From this, the Abrahamic religions teach that masturbation is a sin because it is equivalent to the "Sin of Onan".
I'm sure there are other dogmas that teach masturbation to be a sin. Yet, Onan's sin seems to be the start of most anti-masturbation theology.
However, the Abrahamic religions do not approve of castration to alleviate masturbation. Instead they view it as a moral problem and a sin that should be avoided through adherence to the faith.
From a purely spiritual view, I see no harm in having a nice wank. No babies die if a man masturbates. In fact, a married man attempting to conceive a child would do well to expel the older sperm a few days for having sex with his wife - it would increase the chances of her getting pregnant as the sperm in his semen would be fresh. Sperm remains in the testicles until either ejaculated or reabsorbed into the body. Thus, if a man doesn't ejaculate for a long period, the sperm at the front of the line is half dead.
Guilt instilled in childhood, no matter the method or cause, is very difficult to overcome and I don't mean to make light of such ingrained feelings.
On another note, doctors are starting to identify men with a condition tentatively known as POIS (post orgasm illness syndrome). The National Institute of Health (the NIH), about the most reliable source for medical information, has this article on POIS:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5001999/
It's a newly identified problem. Men get physically and mentally ill after ejaculation. Some have minor complaints such as sore muscles and brain fog. Others are literally incapacitated for 3 to 7 days from being sore and in a state of mental confusion. It's an interesting article. But, it doesn't suggest castration as a "cure". Mostly because the article concludes that while the complaints and the patients are real, the cause and possible cures are not well understood.
I've wondered for a while now if POIS is a reason some men seek castration.
The shorter answer to this question would be that my interest in eunuchs has nothing to do with my spirituality.