Julian Jaynes' The Origin Of Consciousness In The Breakdown Of The Bicameral Mind has been sitting on my bookshelf, partially read, for a long while. Jaynes' theory of how humanity developed consciousness is bold, fascinating, and almost certainly wrong. But it's worth reading nonetheless.
This review of the book by Scott Alexander is a good place to familiarize yourself with Jaynes' ideas.
As you go about your day, you hear a voice that tells you what to do, praises you for your successes, criticizes you for your failures, and tells you what decisions to make in difficult situations. Modern theory-of-mind tells you that this is your own voice, thinking thoughts. It says this so consistently and convincingly that we never stop to question whether it might be anything else.
[...] I conclude that giving yourself multiple personalities is actually pretty easy under the right circumstances. Those circumstance are a poor theory of mind (I think borderlines are naturally bad at this) and a cultural context in which having a multiple personality is expected.
Jaynes says ancient people met both criteria. They had absolutely no theory of mind, less theory of mind than the tiniest child does today. And their cultural context was absolutely certain that gods existed. Just as we teach our children that the voice in their mind is them thinking to theirselves, so the ancients would teach their children that the voice in their head was a god giving them commands. And the voice would dutifully mold itself to fit the expected role.