It's kind of ironic but it seems to me that religion has actually utilized evolution.
The Soul Crawls from the Primordial Ooze: Religion has managed through trial and error (random mutation) to keep traits that would protect it over thousands of years. I imagine the first instances of religion were just the idea that we have souls and do not actually die when our bodies die. A way to ease our natural fear of death.
God and Heaven: Later, humans started seeing holes in this theory. It didn't make sense on it's... and it was forced to grow some fins to help it swim... it needed a story or mythology that would make it seem more believable. That story is the various stories of god... that the world was created as a testing ground to see how amicable your soul was. To then decide whether you were rewarded or disciplined in the afterlife... that mythology was "RELIGION". The added bonus was control of people...
The Flight of Belief: In order for for religion to work it needed to spread... religion needed grow wings. There had to be consequences if you were to falter from believing. If you stopped even believing in god you would be punished! This was enough to keep people a part of the religion. This threat to human well-being would ensure that humans tried to convince not just themselves but their loved ones and even strangers to follow this path. On the surface it seemed that this was beneficial for all because it made the world a more amicable place to live.
The Power of Indifference: All of these claims may not have survived if it wasn't for one beautiful truth. No one knows for sure. As ridiculous as it all sounds, no one can prove that God does not exist. This was probably the facet that made religion so fit for survival. This ultimate truth that one cannot prove a negative. And so humanity realized that by merely convincing themselves that they believed in this God... they could be thwarting an unprecedented amount of pain and anguish. So why not convince themselves of this? Why not convince everyone?
Unfortunately for religion, extinction is also a part of evolution...