I think of it this way...
Human intelligence developed hand in hand with language. Language is critical to articulate complex concepts. Animals have body language and rudimentary audible language, but no way to define concepts like 'deception' or 'greed'.
So... what happens when human become curious about themselves and the world around them? How do they try to comprehend the seasons, the sun, the moon, the stars, constellations, weather, animals, plants, fire, sex, birth, growth and especially death?
It's obvious that humans naturally develop cohesive world views to make sense of everything around them. Humans will also naturally resist anything that may cause a major paradigm shift of their world views, and also ignore minor inconsistencies that could potentially cause such a shift.
Anyways, early humans did not have the insight to worldy phenomena that science provides us today. What did they do? They explained them the best way they could, using their knowledge and logic to formulate answers the same way we still do today. Early religion wasn't 'religion' in the modern sense of the word, it was a complete, cohesive world view necessary for the growth of civilization and culture. These views became tradition, handed down for generations. Native American culture is a good example of this.
IMO, religion can give people a sense of community, an identity, exclusivity, or whatever but those are purely social. All the other explanations that religion provided were made obsolete by the discoveries that revealed the true nature of the world around us.
(BTW, I was raised as a sheltered Christian child, went to Christian schools and studied the Bible for years. I had a truly honest blind faith when I was young, and it all made perfect sense to me until I became entralled with things based on logic and hard science. Then, the inconsistencies and contradictions became incredibly obvious. That is not meant to offend anyone )