This is already happening as well: while the hinterlands of Britain voted for Brexit, it was widely unpopular in London, Scotland, Northern Ireland, and other regions, and may lead to the breakup of the UK. I could easily see a future where cities declare their independence and then organize a loose global confederation of free-trade agreements and mutual assistance pacts, leaving behind rump states ruling over the rural areas of what used to be their country. Then add in private corporations (incubated within the cities) to provide physical security for travelers and migrants who pay for the service.
However, the model of the Hanseatic cities:
https://en.wikipedia.org/wiki/Hanseatic_League
may be something that certain cities or city-regions could theoretically try to set up.
On the contrary, citizens become more nationalistic. The pendulum will swing right again. EU falling apart already due to it.