Religion is something that we created along with our human language to control our environment and each other. It was a separation from the parts of us that we share with other beings and a stepping off into the abstract. The scientist and the theologian are more alike than different.
Our very ancient ancestors, our "primitive" ancestors were so well adapted to their environments that they didn't have a priest class as such. There were shamans but the shamans hunted and gathered along with everyone else with only rare exceptions.
With the rise of agriculture there came a leisure class and a priest/banking class. That's when the cognitive biases really got going. "Why do you get to sit around and boss and I have to move these boulders?" "Because I am noble" "Because I am holy."
All abstractions that require a lot of strategy and marketing to pull off.
The invention of "Religion" has less to do with emotions and intuitions and more to do with getting trapped in our own "reasoning" while trying to control the emotions and intuitions of the peasant class.