Reader Jason alerted me to this article that says that the emergence of all-powerful gods came after the rise of civilizations.
The idea that an all-knowing god was necessary for large societies to function and hence must have come earlier has a plausible argument.
One popular theory has argued that moralising gods were necessary for the rise of large-scale societies. Small societies, so the argument goes, were like fish bowls. It was almost impossible to engage in antisocial behaviour without being caught and punished – whether by acts of collective violence, retaliation or long-term reputational damage and risk of ostracism. But as societies grew larger and interactions between relative strangers became more commonplace, would-be transgressors could hope to evade detection under the cloak of anonymity. For cooperation to be possible under such conditions, some system of surveillance was required.
What better than to come up with a supernatural “eye in the sky” – a god who can see inside people’s minds and issue punishments and rewards accordingly. Believing in such a god might make people think twice about stealing or reneging on deals, even in relatively anonymous interactions.