Hearing voices from people that aren't real is a pretty serious mental condition. I'm convinced religion and all the evil committed on its behalf all just trace back to the root of shit mental healthcare.
On a similar note, the old testament had a historical purpose - to unite disparate tribes and create a national identity against the threat posed by the Assyrian and Babylonian Empires.
The new testament is just a collections of writings and letters. We have no idea who wrote them, they lied on the cover saying the texts are written by the apostles. And by a pretty arbitrary process, a bunch of priests picked their favorite writings and made them into a cannon.
If the same thing happened today, nobody would believe them outside maybe a fringe cult.
Perhaps partly, my personal belief is the is traces back to early tribal days. I believe the first cultural leaders likely struggled with retaining control and authority at a certain point. After all, there is only so much you can threaten people with to keep them in like. The worse of which is death. A sufficiently motivated person may not care about their physical well-being if they want to achieve a important enough goal. Create an invisible "soul" and a space wizard that determines if that soul gets bliss or torture after death and it adds a new level of control.
Problem with that hypothesis is that pre modern people treated death very differently with in many places it was quite literal and physical, for example in ancient Germanic societies they thought of the underworld as someplace only the dead could travel to as in the actual corpses went to the underworld at night and returned to their grave during the day. Hell we can even see the ideas of the soul being refined during the Hellenic period with most philosophers settling on it being an "animating force" which is vague but about right with the ancient Greeks. The idea of the soul is probably relatively recent IE middle stone age at the earliest, and probably evolved out of far more ancient animistic traditions.