If you read portions of the transcript of the original Vergara trial and the decision written by the judge, it is clear that it was poorly decided and that the judge had an opinion not supported by the facts in evidence. The decision has been called “not even a B- paper” by legal scholars.
For example, some of the teachers named in the suit did not have due process (tenure). And, some of the student plaintiffs admitted to skipping school quite a bit and not doing homework, but blamed their failure to do well in school on their teachers.
Tenure is not the reason that there are poor teachers in poor schools. The reasons include that teachers prefer to live and teach in better neighborhoods, so the turnover rate is very high in poor areas. Most teachers in poor schools haven’t been there long enough to have tenure. Administrators, who have a big effect on the quality of life for teachers, are also generally worse in poor schools, so good teachers move to good schools to escape bad principals.
Also, there aren’t enough people getting teaching credentials in California (down something like 58% over the past few years), so the teacher shortage is getting really bad in underprivileged areas. Even in “good” school districts, it is getting difficult to find reasonable substitutes, because the good substitutes have been hired as teachers. Hopefully with the new ESSA, the test-and-punish era is winding down, but flawed VAM-style fire-the-teachers-with-the-lowest-scoring-students policies are still discouraging college students from looking at teaching as a career.