Let's look at Turkey.
Till the 19th century it was an autocracy ruled by a Sultan, in theory absolute in power. (In practice he had to move pretty quickly at times to avoid getting the chop. Same has been true of pretty much all "absolute monarchies" down through history.)
While everyone knew the monarch was a Turk, the Turks were in theory and practice just another of the peoples (millets) under his rule. There was discrimination against various millets, but generally more on the basis of religion than ethnicity.
When the Young Turks took over, suddenly Turkey became a specifically Turkish linguistic/ethnic nation-state. Other groups might be tolerated, but they by definition were not "real Turks" and by definition it wasn't "their country" anymore.
Some of this was religious, and there is no doubt non-Turkish Muslims fared better than other religious/ethnic groups. But even the Kurds, Circassians and Arabs were not "real Turks" anymore.
Meanwhile the same corrosive desire for a "nation of their own" that led the Young Turks to want one for the Turks led all the other groups to want one for themselves too.
Things spiraled downward from there.
To look at it another way, let's imagine if USA defined itself as a nation-state for "white Americans," defined as people of northern and western European ancestry. While we might talk a good game about how us "real Americans" would tolerate and provide civil rights to Italians, and Mexicans, and blacks, and Chinese, all these groups would be perfectly aware they were not and could not be "Americans."
Or look at Sri Lanka. For centuries it was ruled by colonialists. The two main ethnic groups, Sinhalese Buddhists and Tamil Hindus, had lived together more or less in peace.
After independence they continued to get along more or less as you say. Then Sinhalese "nationalists" came to power on a program of "Sri Lanka for the Sinhalese." Sri Lanka was to be the Sinhalese nation-state. The Tamils, a definite minority, could never win an election, whether they took place or not. So many of them responded by launching a decades-long war for autonomy and/or independence. They too wanted "their own" nation-state.
Same thing happened to Yugoslavia and in various other places around the world.
IMO nationalism of the ethnic-linguistic variety is pretty much always a negative thing and is disastrous when the territory of the "nation" is not homogenous.
A further emphasis on religious (Islamic) variety in this case & nowadays. Yes, it is dysfunctional. Also that Iranians, in this case, are not Turks. Completely different history, culture & more. Though they are neighbours & able to influence one another.
Btw, unsure if you speak or understand Turkish and/or Persian (farsi) - they are completely different languages. Though your grasp of the meaning of the word "millet" is very accurate. Only that the word "millet" (Turkish pronunciation) is pronounced as "Mel-lat" in Persian. In Persian (farsi) language & context - it is literally & often used as "Mel-lat_e Eeraan" (Nation of Iran) - in which case, it means all Iranians, regardless of ethnicity, language, race, or religion.