Sex-negativity is an important tactic of high-control religions. If a religion can get adherents to constantly police their own natural urges, then that's an effective way to entrench the religion in a person's mind. They end up being constantly reminded of their religion. Repeat this across multiple religions and multiple centuries, and now even secular society thinks that sex-negativity might be the way to go.