I agree that death is not the only motivation. Many people do assume that if a god exists, an afterlife also exists, and I'm sure that's comforting to them, but others want someone watching out for them, or if not individual people, the general welfare of the earth. Others may not find any comfort in God, but believe that it's necessary to explain the universe or life.
I do think an afterlife has something to do with people's acceptance of certain religions, though. The religions that have become popular are the ones with an afterlife. Judaism doesn't promise that, and they're a pretty small religion. Christianity and Islam, on the other hand, are really popular.
I don't believe in an afterlife, and while I admit that has been an uncomfortable viewpoint at times, at other times, it actually has been kind of comforting. When I REALLY think of living forever, it doesn't sound that great. And it's also comforting to think that the many people who are having terrible lives, suffering greatly, it's comforting to think that they won't suffer forever.
As far as I'm concerned, I'm going to feel like I lived forever because that's all I perceive -- not before or after death. When I'm dead, I won't know it. Life is all I will ever know. That's a nice thought, too.