Anyway, all the various forms of democracy were invented in nation states. Places where the entire population felt some sort of common identity. Where one lot could lose an election but believe that they might win the next one and, crucially, that those in power would peacefully hand it over. Nearly every African country is not a nation state but one made up of many tribes who manifestly do NOT feel the sense of common identity that would allow 'democracy' to happen, which is the main reason why democracy just has not happened is nearly all the African continent.
Which is why I believe the world needs more nationalism - and why those who try to divide the US into separate 'nations' are dangerous enemies of democracy.
Gandhi was a nationalist. So was Hitler, even though he had some globalist ideas.
The Nation state was invented as nothing more than the replacement for the feudal state. A state that is run by and for the inhabitants, rather than a set of nobles.
That usually (but not always) means civil rights, representative democracy, and some form of constitution. Things you don't have when you have a feudal lord.
In Europe, most states became true nation states around 1848, and you will find a lot of constitutions from around this time. Many copy heavily from the American and French constitutions.
In fact, a whole new set of tyrants had to be (re)invented for the powerful to subvert the nation state for their own purposes. But by appealing to tribalism you get much the same effect with Nation states as when using tribalism to subvert religion, race, dietary habits, sex, etc. You get people who despise those not of the tribe and are prepared to do nasty things to them, or at least look the other way when it is being done. Identity politics is no recent invention. Crusades, Jihads, toxic feminism/masculinity, and racism, are all manifestations of tribalism. When it comes down to it, they are just different labels for the same driving emotions.
So it may seem unreasonable that the Nation state is singled out for conflation with such hate and stupidity, but it is hardly surprising.
Nation states have been the movers and shakers in all of recent history, so they are what people connect with the horrors of war and persecution. Gavril Princip was a Nationalist, and him kicking off WW1 was way too easy because of other Nationalists. Of course when you look back, non-nation states warred with much greater frequency, since those in power and with something to gain were much more isolated from the consequences thereof than in a Nation state. But that is hypothetical and too vague for most people to grasp, so regrettably many are fine with dissolving the nation state in favor of a new set of feudal'ish entities.