I think religion is all human creation. As Descartes stated, “I think, therefor I am.” We, human beings, are capable of two kinds of reasonings: Deductive and inductive.
Science is all about deductive reasoning. Over centuries, we have accumulated huge amounts of knowledge, but the more we know, the more we need to know. Then inductive reasoning comes into play – people start to have imaginations about the things we are unable to explain. This is how religion is created.
As we are free beings, different groups tend to have different religions. But all religions serve the same fundamental human need – the desire to understand, along with the ideas of good, virtue, meaning of life, etc. compared to bad, evil, sins, etc.
Human beings, through biological evolution over millions of years, are able to have these two distinctive ways of reasoning, this is how we define who we are.
Put this in the cosmic context, human beings are creation of the Earth, most likely by chance, just like a small particle jumping around in a quantum universe or multiverse, with different dimensions.