I wonder if anyone here has researched how man developed into a creature that believes in an afterlife, that feels it has a "soul" apart from its body. I suggest dualism came about because of a need to believe in an afterlife, which reveals a fear of the end of one's own existence. Animals have survival instincts; they pine; they grieve. But do they actually fear death? Is it an accident that humans developed rituals and taboos around the subject, or did* it serve some adaptive purpose? Did shamanistic con men use it to increase their own power and importance?
It seems to be almost a defining factor in the development of modern man. This isn't even just about religion - many us intuitively separate body and mind. Language reinforces the idea of separation, with concepts such as "willpower" and "mind over matter."
Why did humans develop this way?
Ghosts often enforce the morality in many societies. One doesn't murder because one is afraid the ghost of the murdered will take revenge. Alternatively, people often take revenge for the death of a relative because they believe that the ghost of the departed won't let them rest until justice is done. Some people the ghost will suffer until his death is avenged.
Wars start in primitive societies supposedly to satisfy the ghosts of their relatives who died of violence. Groups fight each other to appease the ghosts of their groups.
Here, ghosts are a surrogate for kin selection. The one who murders your relative may kill you in the future. So suppose there is allele that predisposes a person to believe in ghosts. Suppose there is a meme in that community that predisposes people to believe that a relatives ghost will take revenge on the relative for ignoring him. So people in this subculture have less of a chance of being killed then a person who believes in 'forgiveness'.
Ancestral spirits often help their relatives work together. Ghosts tell them to work together, and behave themselves. Children are told not to dishonor their fathers and mothers, who will punish them if they don't behave.
Leaders often convince followers by claiming divination from dead leaders. Leaders are often buried in big tombs. Heroes are buried in tombs. Leaders often divine the future from dreams where they meet their dead ancestors or heroes. The tombs of heroes are often meeting places for people meet looking for signs.
Societies that don't have specific gods often have ghosts. Jesus is technically a ghost, in fact. Jesus may be an avatar from the one true God, but in 'fact' he came back from the dead. All the Saints are ghosts. They are the spirits of dead heroes of the Christian faith. The Saints still tell people what to do. You don't want to annoy your patron saint!
Herodotus the classical Greek historian could not tell if Hercules was a god (always a spirit) or a hero (once a physical human). He found that half the temples to Hercules used rituals directed at gods. The other half used rituals meant to appease ghosts. He concluded there were two Hercules, one a god and one a hero named after the god. Men went to war, protecting their relatives, inspired by the ghost of Hercules.
Religious people often are moral because they think that they will be punished in the afterlife if they are not. People try to convert others in the belief that they will be rewarded in the afterlife. People use these beliefs to train their children.
People pay other people, from ministers to mediums, to contact their dead relatives. The ministers and mediums often tell people to act more moral. So what Christians call the occult often turns out to serve the same organizational purposes as Christianity. And repeat. Jesus is technically a ghost!
So ghosts may have enforced morality even before the pagan gods enforced morality. The alleles that predispose people for believing in ghosts may be the same alleles that predispose people for believing in gods. I suspect the belief in ghosts came before the belief in gods.