Moral inversion

Here’s how I see it:
Originally there were some things which were considered really sacred and good.
Things like sex, idols/statues of gods, books, magic, some forms of science or alchemy, etc.
These things were considered so good that it would be forbidden for some bad person to take them and mess them up.
Next, they became a secret, in an attempt to hide them from the miss-use of the masses.
Next, the secret became forbidden.
Next, the forbidden became seen as evil, wrong, etc.

Therefor there was book burning, suppression of sexual acts, forbidding and killing witches, considering it a sin to have a idol or carven image of a ‘pagan’ god, etc.

If you agree with me that humans are highly foolish, maybe you can see why and how this has happened in society and world religion. There are many examples of this general pattern in history of human culture.