well i have done research on this topic before, religions such as Christianity, and Buddhism were all philosophies first, Christianity in particular was fought against by Rome at the hight of the roman empire, there was a saying that for every one Christian you kill, there are one hundred more. what seemed to have happened was Rome's tactic was to "embrace" Christianity and invite all the Christian leaders to join the Roman plutocracy, effectively corrupting Christianity and destroying its teachings. original Christianity of the time was based on the Torah.
anyhow in terms of why we have religions in the first place, is very interesting. out of all animals on earth, humans seem to be the only ones who think of death the way we do and are the only ones who have thought of notions of god, nature, universe, etc. In terms of our awareness; i believe, religion is the product of our early cognitive developmental stage.