We can only imagine how barbaric and crude life was thousands of years ago. Such was the (lack of) education and knowledge of the masses in those days, Ordinary folk lived in constant fear of the unknown and were profoundly superstitious.
The more informed ruling classes took advantage of such weakness and invented religion.
Instead of the traditional folklore that animals were Gods, the early architects of religion invented a more clearly defined lord and master who was invisible and totally incomunicado. Of course, such a master was so powerful beyond belief he (it) was everywhere. So nobody could escape his constant vigil. To put the icing on the cake, ordinary folk were convinced to believe that this invisible master somehow "made" all that lives.
Naturally, Our ruling class charlatans drafted up rules and codes to impose on the hapless lower-ranked wretches who were led to believe that such draconian dictums were related to a handful of spiritually gifted mediums by the invisible master. Quite coincidentally, Of course, These rules happened to favor the prosperity of the ruling class and oppress the masses. "it is virtuous to be humble and poor and you will go to Heaven".
"Power tends to corrupt" yet what we see here is nothing short of pure evil; those who lust for power and self-fulfillment using those who are gullible and naive to achieve their demonic goals.
Nowadays we are well-educated, free and have unlimited access to quality information. To believe in God or any other supernatural phenomena defies reason and reality.
Yet we still have evil in those who take advantage of the weak and vulnerable and religion would probably be the biggest and most widespread form of evil.
But, Would we still have charlatans and parasites if it were not for the masses of those who are naive, gullible, weak and vulnerable?
Without one, You would not have the other.
Perhaps it should be more apt to say that "because of evil and stupidity we still have religion".