It's the general bad practice of putting individuals into larger groups with a stigma based on visual appearance.
I think a lot of the resentment about bad German skills in my generation (80s/90s) comes from 10+ year residents and 2nd generation immigrants not capable of speaking our language correctly.
We also had a lot of highly educated migrants from Yugoslavia back in the seventies and they were appreciated back then. But after the Balkan wars they were suddenly the bad guys despite some of them being perfectly integrated in our society and sometimes being the third generation to live here.
It's funny how fast the perception shifts and how quickly we are to judge on the prejudices we have of a group of people and not on the individual.
There are reasons of course, just sayin'.
Doing so while not allowing them is cruel and stupid like punching someone for having a black eye and justifying it with their face looking weird.
There is the option to leave the country.
It doesn't sound entirely unreasonable or unfair to me.
Eastern Europeans are very much white. Their accent might give them away but certainly not the skin complexion.
"Hedonistic lazy people with dark hair who steal our daughters" seems to be the general idea. This is somewhat distinct from "lazy people with light hair who steal our things", which seems to be the stereotype against Eastern Europeans.
A lot of Germans are to varying degrees prejudiced against foreigners, especially if you're brown or can be read as Turkish/Arabic or Eastern European. If you pass as white European you're more likely to be read as educated but still learning the language whereas otherwise your language problems are more likely to be attributed to a general lack of intelligence and education.
I'm not saying all Germans think this but there are certain cultural clichés around uneducated "southerners" (generally Italy, Greece, Turkey but also Arabs and everything West of France) and Eastern Europeans speaking broken German the same way Americans have stereotypes about people speaking AAVE.
In other words broken German has a cultural stigma but depending on how you are read you may be less impacted by it. If your career is going to involve speaking German a lot, it's probably advantageous to speak it well.