In the early 1970s social psychologist Henri Tajfel set out to study the minimal conditions required for discrimination to occur between groups of humans. In his tests he discovered that group identity could be easily formed in a very short time using trivial criteria (such as one’s musical preferences or the results of a coin toss), and that groups divided by such trivia would immediately display prejudice against those on the other side, and favor those in the same arbitrary category. He referred to this principle as The Minimal Group Paradigm. This is the psychological (instinctual) root of tribal identity.
Homo Sapiens Sapiens is a social animal. National identity is a proxy for tribe. Tribe is the human analogue of a pack.
In the context of human culture, we can think of tribes as modular components (cultural modularity). The tribe is the most proven, stable social configuration for our species, and it is the default towards which even modern humans gravitate in times of crisis. This instinct pre-dates humanity, and will persist. Failure to account for it invites tragedy.
Large city states are inherently less stable than tribes, because city states do not fulfill the full spectrum instinctual of needs for a social species (they fail to provide the full sense of belonging). Within city states, these instinctual gaps are filled by sub-identities (religious, ideological, political etc..) which often fight among themselves, and struggle for power. As a result, no empire (since the dawn of city states 10,000 years ago) has ever come close to achieving the longevity of tribal lineages. In fact most collapse within 300 years.
The pack instinct is a survival adaptation. Those who are able to coordinate their efforts with those around them are able to accomplish exponentially more than those who attempt to go it alone. Groups which define and maintain a strong shared identity are more stable than those which do not. This provides a selective pressure which will always come into play during times of upheaval.