Why are some religions patently illogical in their ideologies and beliefs about sex?

Religions have proposed several answers to this question. They include the idea that because we have all sinned against God, we deserve whatever punishment we get. This answer faces various problems. If the above were true, we would expect that bad people would suffer much more than good people, but this is hardly ever the case. It is often the best people whose suffering is the greatest.

Another problem is that bad things happen indiscriminately. Examples would be the diseases that affect innocent children, and the pain that is endured through natural disasters such as floods, fires, earthquakes and volcanos. It has been argued that God sends suffering to us so that we can become better people. If this were the case, we would expect that believers who endure the greatest pain would rise to the greatest heights. But it can happen that a person who previously trusted in God can turn against him, feeling that the divine being was responsible for inflicting undeserved pain.

 Whichever way we look at this question, the answers that are proposed are inadequate as an explanation for the suffering that is endured by many people whose lives are examples of goodness and goodwill towards others.

What do you think of the approach to sexuality adopted by certain religions?