I’m guessing religion.
Religion is the excuse, not the cause. There's a fair number of religious institutions which are queer friendly or at least queer-indifferent. You gravitate towards the religious group that echoes your own biases. Those biases aren't imbued by some supernatural force. They're the result of material incentives and social divides that demagogues exploit when they fashion a religious doctrine.