Similar discrepancies can be seen in other noun groups, for example "a beer" is fine, "the wine" is fine, but "a wine" sounds weird.
For the cases where usage of the word as a noun isn't considered idiomatic, people usually say "a korean person" or "a german guy" or "british woman", etc.
There is a similar phenomenon with "a Jew", which was once common and where now most speakers would use "a Jewish person" (except, to some extent, for Jews using it as a self-description, although "I am Jewish" is more common than "I am a Jew", but their denotation is also different because the former foregrounds religious identification and the latter foregrounds ancestry or ethnic identification).
Apart from the "person-centered language" phenomenon that other people have mentioned, I think there's the closely related euphemism treadmill
https://en.wikipedia.org/wiki/Euphemism#Euphemism_treadmill
where even a completely neutral term may acquire a negative connotation because of its widespread use in a negative sense, or by people intending to give it a negative connotation. Or people may simply fear that a neutral term has acquired a negative connotation by recalling that it was widely used in the past.
As other commenters have pointed out, there are still demonyms which are common to use in the singular and their idiomaticity has tended to change (mostly in the direction of stopping).
Although I think there's an interesting phenomenon where new countries' demonyms feel plausible to me in the singular ("an East Timorese", "a South Sudanese", "a North Macedonian", "a Kosovan"/"a Kosovar"). It's hard to prove but I suspect that the relative novelty or unfamiliarity of these terms acts to alleviate speakers' internalized fear that they might inadvertently be using the same terminology that was previously used by xenophobes!
But I'm not totally confident in that.
It would be interesting to gather more data by surveying a lot of native speakers about a lot of demonyms and trying to quantify the possible influences of (1) familiarity, (2) phonology, (3) history of ethnic conflict, ...
Another one that feels kind of parallel is the arbitrariness in whether you use a definite article in the name of a country. For example, "the Sudan" and "the Ukraine" used to be very common in English but it's not unusual to see the country names without the article now. On the other hand, "the United Kingdom", "the Netherlands", and "the Maldives" are still always "the". This is different in other languages, where for example "Switzerland" is never "the" in English, but is always "the" in German ("die Schweiz"); "Japan" is never "the" in English, but is always "the" in Portuguese ("o Japão"), as is Brazil ("o Brasil"). It's challenging, though maybe not impossible, to give a clear account of the origins of all of these distinctions...
Edit: in Arabic, too, some countries are "the" and some aren't, but it also doesn't correspond with English practice.
It doesn't sound abnormal to call someone a Korean, or most of the 'an's. But it does to call someone a Chinese/Japanese, as it's only used in the adjective form. We used to have noun forms, but they were deemed offensive long ago - so I'm not sure what the correct way is today.
Americans have had plenty of racist/hostile opinions against Mexicans or Russians, yet "a Mexican" or "a Russian" remains totally fine.
From the Wiki article on demonyms though, "Often, demonyms are the same as the adjectival form of the place, e.g. Egyptian, Japanese, or Greek."
I guess you'd also not say "I am a Japanese", but probably just "I am Japanese"?
For country names ending with "-ese", it's usually an insult to call someone "a" something, like: Chinese, Japanese, Lebanese, Portuguese, or Vietnamese.
With these countries, it sounds better to say "I am from X" or "I am X", such as "I am Japanese".
There is "chino, japones, italiano, frances, aleman". Full of different Romance suffixes and we put functionality over ideology.
Too lazy to care, and the noun/adj. roots and suffixes go back to the Latin spoken since the Romans.
We have "ingles" and "britanico" too, yet no one would say a common used demonym can be racist.
Also, hey, any demonym can be used either as a noun or an adjective. Both for people and for things.