Humans evolved from Hominids over millions of years. Homo Sapien specifically evolved from H. Heilelbergensis over thousands of generations. Then humans were nomadic. They had proto-languages, hunted, survived. When cities finally formed stories were shared and became bigger, more important as lifestyle changed. Animal and nature Gods were appropriate for their needs.
With cities larger scale worship happened. MAny tales were combined into larger stories about even bigger Gods. These stories also evolved.
First, we were already fully evolved. Myths were a way to write down wisdom and knowledge but frame it in stories and fantastic tales. So people worshiped fictional creations? So? That is where humans were at. There is no cosmic law that says humans have to know all truths? For a long time it was assumed there were many Gods, Gods for weather, night, day, sickness, the Gods did everything. That was human science. Gods are the answer.
Religious fiction is re-used from Mesopotamian stories to Greek/Persian stories. Now in modern day places like Europe are largely secular and the US is growing more secular. We do not need old myths to frame law and wisdom in and to tell lies about an afterlife.
Has nothing to do with evolution. Man has also spent countless effort on war, political systems, nationalism, doesn't mean they are anything beyond man-made things.
And yes. Humans are smart but they do enjoy mythical answers to questions about death and what is reality. That's just where we are. Some people are placated by fiction and many are no longer satisfied with it.
Humans changed. We realized that the answer to why do things happen is no longer "Gods do it". We now have scientific ways of looking at the world and can review real evidence. Stories about Gods are no different than fiction about Froto returning the ring. Full of lessons, morality, friendship, struggle, doing the right thing, temptation. We just no longer need to worship the good characters to get the morality.
Older religions were not obsessed with an afterlife either. It was about living while you are alive and performing cultic acts to Gods for good weather, health and so on.