Is it true that foreign students have very limited academic prospects in Germany? My question is about this apparently well-received answer on Quora:


  Q: Which PhD programs in Germany would you recommend?
  
  A: NONE...The German Ph.D. system is feudal and archaic. At the top is the professor, who, unlike his Anglo Saxon counterparts, can take as many Ph.D. students as he wants. 20 to 30 is very common. They are used to do the grunt work. If you are a foreign student, the professor will do nothing to help you stay on, network, or find a job in Germany....
  
  In Germany, [it is very difficult to find an academic job]. In practice, unless your Professor pushes you, and he will only push a bunch of favorites who are German, you won't get a job. Why do you think there are so few foreign faculty in German universities? And surprise! Those who are there have PhDs from the Ivy League...If you take a PhD and then try to move to industry, you need to have a job that requires a PhD, and...it will be an immigration officer who decides that....


Is this really the case? I have known few non-German people with German PhDs and none of them mentioned these issues. I especially find it unlikely that anyone can have 20–30 PhD students worth of grunt work in fields like mathematics. Many of the other issues also seem to be present in other countries. On the other hand, there is also this article, which largely agrees.

To narrow the question, let's ask specifically about foreign graduate students in mathematics who seek academic careers.
The German Ph.D. system is feudal and archaic.


Sounds like an opinion. Let's check all points to form an own opinion.


  At the top is the professor, who, unlike his Anglo Saxon counterparts,
  can take as many Ph.D. students as he wants.


True. But it's more like "as many PhD students as he can pay".


  20 to 30 is very common.


No. More than 6 is rare in math, more than 10 is extremely rare. About 1 to 4 is more common.


  They are used to do the grunt work. If you are a foreign student, the
  professor will do nothing to help you stay on, network, or find a job
  in Germany.


This can be true for any professor in any country as well. I do not see any evidence why German professors are worse than others in this respect on average.


  Of course, they are happy to see you leave for your own country to do
  technology transfer!


I have no idea where this conclusion comes from. In Germany the companies often struggle to get good applications and there is no reason for anybody to be happy when a well qualified PhD graduate leaves the country to work somewhere else (except to be happy for that person...).


  In Germany, unlike in most other countries, a PhD qualifies you only
  to teach as a docent.


No. A PhD qualifies for a bunch of jobs depending on the discipline. What is probably meant is jobs in academia. See below.


  To become a professor you need another degree a Habilitation. After
  that, you need to be called to the chair.


Not anymore. There are more ways to become a professor. There are junior professorships (vaguely similar to assistant professorships), you can become a junior group leader at Max-Planck institute or a bunch of other research institutes, get your own funded research group (DFG and BMBF are just two agencies with funding in this direction) and of course being a productive postdoc (with or without doing a Habilitation) is possible.


  If you cannot find a job in the 12 years after your PhD you are barred
  from applying to academic jobs.


No. What is true is that there is a law that says that you can only work on limited time contracts for six years after PhD. But this excludes contracts based on grant money and I've seen more exceptions to this (e.g. for junior professors). Even if you leave university, there is the possibility to return to academia (depending on the discipline) and a professorship at a Fachhochschule even requires work experience in industry.


  In practice, unless your Professor pushes you, and he will only push a
  bunch of favorites who are German, you won t get a job.


This is an overgeneralization.


  Why do you think there are so few foreign faculty in German
  universities.


There are not a lot foreign professors in Germany. Probably the required teaching in German plays a role? Other than that, foreign applicants are treated equally.


  And surprise! Those who are there have PhDs from the Ivy League.


No.


  If you are a Masters then look for a job in industry. If you take a
  PhD and then try to move to industry you need to have a job that
  requires a PhD and in practice it will be an immigration officer who
  decides that.


Immigration officers play a role, but I don't know of any PhD graduate who could not get a job that was offered to them because of immigration policy. As noted in the comments, there are simplified rules as of March 2020 which I don't know yet (link in the comments).