Although this is true, it is only half the story and school system.
You leave out the Fachoberschule, Berufsoberschule (name and curriculum depends on the state) and Berufsschule/Apprenticeship system. While the biggest factor in if someone will go on to study later in life will be if a student attended the Gymnasium from 5th grade on, every single person in Germany has many options to get to a university or university of applied sciences. As for the the schools I mentioned before:
Students from the Hauptschule (until 9th grade) and Realschule (until 10th grade) can attend the Fachoberschule, depending on a certain core GPA and extra coursework for Hauptschul students. Which is leading towards the 12th or 13th grade, depending on if the student wants to attend a university of applied science or a university.
Furthermore, students who do an apprenticeship after the 9th or 10th grade can enter a Berufsoberschule with successful completion of their apprenticeship. These students are often allowed to skip the 11th grade (same curriculum as the Fachoberschule).
Whereas, I have to fully agree that it is hard to switch from Hauptschule or Realschule to a Gymnasium, but it is not impossible and I know multiple people who studied at universities, while starting out at the Hauptschule.