Warning: I'm gonna mention Egypt......
Around 3300 BC, these Levantine and Mespotamian towns - and really, that's all they were at this point - started a trade culture, and the nascant Nile Valley states (three of them) got involved, sharing ideas on pottery, writing and archetecture.
There would probably have been no need to expand these statelets' territories - or create walled cities at all - had Egypt not unified around 3100 BC.
The resultant power of the world's first nation state forced the tradinf towns to unite in culture and diplomacy, forming the first, albeit tenuous, Babylonian civilisation, as a hub for trade with Egypt, and probably for defence as well.
As time went on, the need for alliances and defensive measures forced many of these statelets to coalesce into nations in their own right.
Probably Egypt's greatest contribution to society was inadvertant - the concept of nationhood.