Historically, nationality and ethnicity were one and the same. It is only recently that has changed.
Actually, no. On the contrary.
Under the Feudal system in Europe, it didn’t matter what language you spoke, what ethnicity you had, what religion you had, what culture you adhered to. You served your king or emperor and were thus part of the country of that king or emperor. Your allegiance could change at will, because another king or emperor conqueed the particular bit of land you were farming, or sold it, or gave it away in a dowry. From one day to the next you served a different lord and a different country and were expected to be preared to die for that country in battle.
This was the old fashioned concept of non-nationalist patriotism, dating from Roman times. People were essentially the property of ther rulers.
The whole concept of colonialism was just an extsnsion of that. The old empires were truly cosmopolitan constructs. Countries and cultures that had little in common were tied together and might made right.
Then came the 1848 revolutions. People discovered the concept of nation and nationalism, and claimed to be a nation not because of having a common leader or being part of a common empire, but they claimed to be a nation because they shared a language, a religion, a culture with the people around them, and demanded to be recognized as a nation based on those concepts.
In fact democracy and nationalism were closely intertwined and I don’t think that people at the time thought the two could be separated. Being part of a nation gave you inalenable rights, including democratic ones. But the old empires were not amused, and besides making some small concessions, they crushed the new nationalist and democratic movements and restored the rights of the old rulers.
But these ideas didn’t die. They simmered on, waiting for their moment.
Then came the First World War, and the peace treaties that followd it. The old empires were dismantled (well, actually only the ones who lost) and Europe was carved up into numerous new nation states, based on ethnic nationalism. In many places, the borders were drawn incorrectly. There was power play and corruption at the negotiating table and people were working from incorrect and manipluated data. There were areas of mixed ethnicity and there was forced assimilation and ethnic cleansing and all the wars fought in Europe since, especially the recent ones, were started over such issues. They also very rarely actually solved them but just postponed the problems for future generations to work out.
When Macron said, the First World War was fought to overcome nationalism, he was totqlly wrong . Ther First World War was the birth of nationalism as a geopolitical force. Had that war been avoided, or the peace setteled differently, nationalism might not even be a thing today.
But despite all this, I would claim nationalism has been a force for the betterment of humanity. Without it, we would probably not have the widespread establishment of democacy we have today.