I honestly do not believe that any religion ever invented was the product of such psychological motivations. That's the sort of ethnocentric explanation modern westerners are likely to make up out of whole cloth. I believe the majority of the religions, at least the pre-Christian nonbiblical religions, originally came out of experiences of the supernatural or "ghosts" and that sort of thing, and were fitted into inherited myths, such as the distorted mythified versions of the promise of a Savior all inherited from Eden. But practitioners of such religions, especially those who live a monastic life of disciplined meditation and ritual, also experience all kinds of supernatural phenomena which confirms them in their beliefs.
I don't post much nowadays because I can't keep up with you all, but I felt obliged to pop up because, for once, I agree with Faith. Generic explanations of spirituality which rely on things like explaining what happens to you after death are clearly, as Faith points out, post-hoc ethnocentric explanations, as they ignore every spiritualistiv viewpoint which does not offer any clear explanation of life after death. I think it's much more likely that the universality of religion of some kind or another is simply the result of religious experiences. Where I differ from Faith is believing those religious experiences to be produced by side effects of our complex reasoning process rather than actual experience of gods or demons.
Faith is right, however, in dismissing the idea that religion is simply a way to make death more comfortable. Lots of religions don't acheive that, so a general explanation of religion can't rely on such things.