Religion is the byproduct of the evolution of our mind
But not a necessary one, it is just another intersubjective belief system as is all of human culture. Once we all accept the fact that we are upper paleolithic hunter gatherers it is much easier to see our problems from an objective position.