If I may expand this discussion, the animosity between successive religious schools and gay people has always been rather fraught.
If we look at the origins of what are known as the monotheist religions, sometimes Judeo-Christian, it is ancient Egypt. The God King, worshiped on Earth, whose will is delivered by priests.
This led to a number of variants, Judaism, Christianity, Zoroastrianism and Islam, being the main surviving. Each is based upon the will of a god, as revealed to mortals who must obey, without question.
In reality, each of these is a means of organizing and manipulating people to sacrifice their labour, their wealth and their lives. Even those claiming the authority to deliver the Christian message, continue with the blatantly contradictory claim that we can kill for god.
Form this perspective, religion is about social organisation. Those that fail to conform to what is preceived as a norm are cast out.
The physically and mentally disabled have little to offer either militarily or economically and so are cursed by the devil.
The free thinkers challenge the dictates of those claiming to be appointed and so are are possessed by the devil.
The sexually non-conforming are seen as incapable of reproduction. Perhaps more importantly, in the close environment of a military structure, men interested in men, sensitive men, will be detrimental to discipline. Women who prefer women are less likely to submit to the agressions of real men. The sexually non-conforming are automatically accused of depravity, being a danger, to children, to animals, exchanging their seed with the devil.
The RC, like any other of these traditions, needs little justification for its dictates. The association between masturbation and the Genesis figure, Onan seems to be relatively contemporary. When I was doing my research into ancient references to homosexuality, in the early 70s, I found some particularly old reference books from the late 19th and early 20th centuries. Where masturbation was mentioned, in some cases, there was a reference to God, but none to Onan, even when other rationalizations were referenced to the Bible. The phrase, Fight the Good Fight, for example was taken as being encouragement to fight the Germans in what was to become, WW1. But the anger of god toward homosexuals and self abusers was a given.
It's very sad for those who have developed a dependance upon groups like the RCs, the Mormons, Islam, Judaism, to be lied to in this way. It is really a quite disgraceful betrayal by each. The reasons for the current emphasis upon imposing disgusting sexual morals is the current obscession with what is claimed to be a degeneration is society. The reality is, societies, all societies, are more peaceful, more secure, healthier, happier and more contented, than they have ever been at any time in history. The problem for these groups is that too many of their followers are no-longer listening to them. And these groups can't seem to figure out that the reason is, we don't like being lied to.