What law is this breaking?
Employers need a reason to fire employees.
This prevents them from reaching into people's private lives, like Huawei is doing here.
This almost certainly doesn't matter.
If someone is working, full time, in the german office, for years, then they are almost certainly covered by german labor laws, even if they are a chinese national.
But if your employer justifies any negative action towards you with "the person made friends in their private life", you can probably sue for harassment/bullying.