Great post! However, do you have any sources to back your claim on religion? Not sure if you are saying, that religion is required 'as a motivating force' for building a stable society or for writing thoughts down. Both developments can be explained well without religion, no?
For a long time people had that idea, but new findings may challenge that view. The Gobekli Tepe site, near Urfa, Turkey (http://www.smithsonianmag.com/history-archaeology/gobekli-te...) is dated to ~ 11K years ago and is thought to be the world's first temple. This pushed back the dawn of religion quite far back.
"To Schmidt and others, these new findings suggest a novel theory of civilization. Scholars have long believed that only after people learned to farm and live in settled communities did they have the time, organization and resources to construct temples and support complicated social structures. But Schmidt argues it was the other way around: the extensive, coordinated effort to build the monoliths literally laid the groundwork for the development of complex societies."
This view has not been accepted by all, but it had generated quite a bit of excitement and discovery.
No one knows for sure, and it's a running joke in anthropology that anything poorly understood among ancient peoples is declared "religious", but it's probable that religion emerged at the same time as law (the real motivator behind inventing writing) and that they were deeply intertwined.
Belief in the supernatural exists for genetically hard-wired reasons, but the first truly organized religions were probably not the live-and-let-live shamanic practices that began among hunter-gatherers, but ancestral cults with some coercive intent. The most important question of law has generally been: who should own what? This is where the ancestors (cum deities) come in. A king will just have you killed if you steal his possessions. What happens when he dies and his less charismatic son wants the same power and privilege? His son says, "If you don't show the same loyalty to me as you showed my father, he will possess a lion and that lion will eat you." This raises the possibility of an afterlife. A generation later, the grandson says, "If you disobey me, my grandfather will torment you forever in the afterlife." Eventually, these ancestors became gods and their accomplishments are magnified to supernatural levels of achievement. Three thousand years of oral tradition later, with a human ancestor morphed into a fictional character and no one able to determine who the "real" descendants were, priests (people of high social class) become the intermediaries. Divination, religion, and law were intertwined at this time. Law began from the question, "How do we organize our society to keep the gods happy?" And it needed written tradition to keep track of what worked and what didn't. Most of what was being divined at first was who "rightfully" owns land, possessions, and people-- and gambling, for the record, probably has the same roots: Let's ask the gods who should have these resources.
This is not to say that pragmatic, civil law could have emerged in the absence of religion, and I'm sure that half the architects of ancient law were thinking, "I don't really believe in this supernatural shit, but these ideas work", but it seems not to have happened that way. Modern philosophy didn't even exist until 700 BC at the earliest, by which point the ancestors and divine-kings and gods were well-established.
By the way, I don't mean to disparage religious belief outright with this summary. I'm a skeptic who generally finds organized religion silly, but I'm actually a deistic Buddhist, not an atheist or agnostic. That, however, is a discussion for another time.
The main thing here is that in good times an agricultural society was able to produce surplus. And the existence of this surplus made hierarchies possible: suddenly the society could afford to have a non-working ruling class.
Organized religion probably arose from the possibility of surplus combined with an agricultural society's need for having someone observe the seasons and predict weather.
It seems to me that it's quite rare that humanity addresses concerns on any scale before they actually become problems. If that's the mistake, we sure do make that mistake a lot.