I personally believe religion is a side effect of how our intelligence evolved, and how our brain works.
We are a curious species, pondering, we love patterns, even to the point that we see patterns where there are none (because that can have evolutionary advantages). Guesses is better then no action at all.
I suspect religion has been unavoidable for an advanced intelligent species, not necessarily in an organized form as homo sapiens has had it though but that has worked well for our social structure.
I think we humans want to have an answer for everything. Even if we have to make one up.