For the same reason when I was little I spoke Serbo-Croatian and now I would speak Serbian, Bosnian, Croatian or Montenegrin.
Seriously it’s just a matter of self-identification
In the OP example about a third of the people in Iraq are not Arabs but Kurds. A lot of Algerians are Berbers and most are mixed Berbers and Arabs.
I know Native Americans that will self-identify as Latinos or Hispanics, because they were born in Mexico and speak Spanish, even though they don’t have one drop of European blood in them.
The terms are “invented” just as a convenient way to classify data. For instance in the USA, Spanish is more and more important. I see many jobs now saing Bi-Lingual required, especially in H/R.
If you ever called a Cuban a Mexican or a Puerto Rican a Dominican you will see they will correct you quickly. But the fact they speak Spanish is useful for the government to know as they need to provide services.
A hundred years ago in major urban areas it was common to have a lot of languages spoken. But it wasn’t classed as English was a common device of learning. Now with broadcast media such as it is, and immigrants having quick connections back to their country they don’t lose it.
In my mum’s day when her family came here, they never expected to ever go back to Yugoslavia for any reason. They severed ties and became Americans. Now, immigrants through Internet, cheap phone rates, and airplanes can keep in touch and visit their homelands, so the connection stays alive.
But it’s really SELF-identification and who asks.
For instance, if an American would ask me my background I would say Serbo-Croatian. But if an Australian asked me, I’d say “I’m an American.”
Or like the term “Yank” outside of the USA a “Yank” is anyone from America.
Inside the USA a “Yank” is someone from the north part of the country.
If you’re in the north part of the USA a “Yank” is someone from New England
(Yes, I know those aren’t hard and fast rules, but you get the idea)
The thing is people think if you group things it must always be for a bad reason like to discriminate, and while it CAN be used for that, it can also be used for good things too. Like taking a driver’s test in various languages