Irrespective of the reality of an afterlife, the very fact that the vast majority of cultures seemingly independently developed theories about it suggests that people do, in fact, come to the conclusion that there is an afterlife without starting with the belief.
People like to talk about religion as though it's all indoctrination, but the argument really doesn't hold up. Religions that focus on proselytism seem to spread faster, which is unremarkable, but religion definitely seems to form spontaneously.