I've been learning a bunch about the early/mid bronze age recently, and my understanding is that they co-developed. In a lot of ways the temples were repositories of information infrastructure to handle large groups of people. Writing for instance developed in the temples in order to keep track of agricultural stockpiles and essentially to run their economies.