In sociology shame is most often defined as a (real or imagined) threat to the social bond - we feel shame when we do something that people around us may disapprove of.
The notion that masturbation is a sorry substitute for "the real thing" will cause shame if you subscribe to it. It's actually part of a very conservative world-view where women are expected to be available for men who need to empty themselves every now and then. . . .The good old, religious times.
The part that the anti-sex religious groups fail to see is that shaming sexuality sexualizes shame. By causing someone to feel shame at anything sexual, they create an association in that person's mind of shame with sex. It then gets wired into feeling that the shame itself is a turn-on. In other words, they create some of the very "perversions" they claim that sex shaming will prevent. Think of Larry Craig, Josh Dugar, David Vitter, Dennis Hastert, Jim Bakker, etc. All holier than thou while hiding deep, dark secrets--some of which genuinely deserved to be shameful (incestuous sexual abuse, for example.)
I would also add to hergestridge--the notion that masturbating is so shameful has fed the view that rape--something that should be extremely shameful--is somehow less shameful and therefore justifiable.