Don’t expect the Old Testament to present a thorough and precise history of humankind. That’s not what the original authors and compilers were trying to create. Their larger concern was to teach something about God—about His plan for His children, about what it means to be His covenant people, and about how to find redemption when we don’t live up to our covenants."
I suspect that statement is likely true.
I have a different read on the purpose of the Old Testament. It was not about a deity, but about explaining the human condition in terms of a deity that is proclaimed to be tri-omni. Human misfortune is defined as punishment for sin. Why does man walk the scorched earth in search of food only to die, often from childbirth? Why not immortality in paradise? Sin. God hates it.
Look at the flood story. Why is that in there? Floods aren't known to cover mountaintops. The story depicts a hapless and immoral deity, one that fails to make man as it wants him, blames man, destroys most terrestrial life in a particularly cruel way rather than just download new software into man alone, and then repopulates the earth using the same breeding stock. Who writes a story like that about a deity and includes it in a holy book? I suggest that it is people who found marine fossils on the highest mountain tops. The rest follows - all land must have been submerged, and since God did that, and God is good, it must have been deserved. And the deity's character is filled in a little more, complete with a promise to never do that again if man will just conform to a covenant. Why else would we have that story?
Other phenomena are also explained in terms of sin - the diaspora, and Sodom and Gomorrah. I'm assuming that two neighboring towns were destroyed by some natural phenomenon, and this needed explaining. So, the character of this all-powerful and good God evolves to account for what man sees.
Why is there a creation story in which a tri-omni deity needs six days to create everything, and then a day of rest? Again, not as flattering as one who creates all at once in an act of will, and needs no rest. Why is that story in there? One answer jumps out at us. Once, all able-bodied people were expected to work every day, and failing to do so was deemed sloth. Eventually, man settled in towns and grew to larger political units than tribes. The holy man was no longer always always close at hand as he had been in the tribal days, and permanent temples were established that might be a few hours away and require a few hours in the temple, taking up much of a day. This was essential for the priesthood, who now needed tithes to survive rather than a share of the kill as had been the case in hunter-gatherer days. So, the work week was born complete with the weekend. God took six days to work and then off work, and it became a sin to work on that day where once it had been antisocial not to work every day. Why else do we have such a story?
The story of Job is another such story that depicts the deity rather unflatteringly. It toys with a good man's life for no good reason - something about demonstrating something to Satan. Why is that there? I don't have a good answer for that one. I suppose it is to explain why bad things happen to good people even when they are upright, even with a tri-omni deity in control, but I don't find that as compelling an argument as the global flood and week of creation stories.
So, the character of the deity conforms to whatever is needed to account for daily life in the Old Testament, and an angry and jealous yet loving God is created. He's angry because He loves us, and we disappoint Him, but like a good and loving parent, corrects us when we need it, so much does He love us.
By the time of the New Testament, this is no longer true, and the central character there is now no longer need to explain to explain life as we see it, but as we hope it to be after death.