IMO, religion has three causes: a) being aware of death, b) a desire to explain, c) need for a parent-in-adulthood. Religion is on the decline in the developed world because religion can't explain much of anything that science can't much better. It's explanatory power has been stripped bare of any meaning and therefore open to ridicule for those educated or rational enough to do so. However, a) and c) remain strong as causes and so we should expect religion to remain in some form until they have been eliminated. Simple as that.
I've always hypothesized that it was mostly a and b, with both stemming from traits that we possess almost by definition as a reproducing species: 1) a survival instinct, and 2) the ability to learn. Possessing a survival instinct coupled with an awareness of death essentially colors, taints, and otherwise poisons the desire to explain stemming from our ability to learn, which does not turn off in life. By definition, human creatures in the aggregate want to always continue. It's a side effect of wanting to continue at all in the first place, -it doesn't turn off (again, in the aggregate. Biology is full of exceptions, and indeed needs them). When your psyche requires that you lust for, value, and exert maximum effort to continuing to exist, it is no wonder that we invent myths that promise us what we desire most at a fundamental, biological level. We come to a place where our collective explanations across civilizations and time echo each other in very predictable, comfortable ways.
When science undermines some of these comforting explanations, it is confronted with a bias that is not just historical, or cultural, but biological as well. As far as C goes, I imagine that it plays an important role psychologically for obvious reasons (and probably plenty that aren't obvious at all to me), but I never placed it near A and B myself. I would sooner give the C position to JakobVirgil and his belief that religion = rules, since I believe that rules/laws are inseparable from social creatures living in groups and religion is intimately compatible with lending authority to inevitable rules.
There are plenty of cultures were belief in an afterlife and religion only have tenuous connections or none at all Classical Paganism and Temple Judaism stand out as particularly relevant examples to the west . the Greeks of course had a god of the dead but he was no where near the center of worship. I think the West's assumption that religion = afterlife has to do with path-dependency. (That member of my tribe who thinks his birthday is so important that it messed up my Blake's 7 watching schedule.) To throw some more fuel on the fire James Fraser thought religion had its origin in charlatanism and wrote 13 volumes on that thesis.
IMO we do not know the cause of religion. The theory I find the most compelling is Religion is tribal law at the constitutional level. The things that a society holds sacred and beyond discussion rights, privileges, when to plant and harvest, maintenance of symbols that define a people, marriage, life thresholds and hopefully ethical behavior etc. The Myths and Rituals are secondary to and largely serve as mnemonics for practice. your a) and c) (and most of b) I think are a product of western soul searching , affluent angst and other modernisms.
(not on your part but on those that proposed them.) They are just too low on the list of needs of non industrial people to explain the origin of something as universal and ancient as religion.