In my mind, the legitimate function of taxpayer-funded universal public education is to teach future voters the founding principles of the Republic, and how and why this country works as well as it does, based on those principles. It’s legitimate, because ignorance of these things would inevitably lead to the Republic’s collapse.
There are many who say, and I agree with them, that the “ignorance of these things” that we currently see is by public education design, and not an accident.