The reason we don’t know the purpose of schools is because we don’t apply critical thinking to what people are for. Everything we currently assume about economics and human activities is actually backward from what the planet (and future life on it) needs. (This is a long rant..but it’s between an answer and a story of its own.)
Civilization itself is a cheat: humans isolate themselves from the risks and needs of the natural world, thus destroying both the natural resources and civilians’ senses of what life itself actually is. Resources are extracted, converted and consumed for no useful plan whatever (the Invisible Hand Job) while children are treated as a costly problem rather than potentially useful contributors to the world.
Schools are a system of indoctrination to civilization (and a poor one at that: as you point out). Elementary schools teach 7 year-olds to act like other 7 year-olds (not to mention what it does to the teachers), while junior and high schools are a social filter that favors bullying and isolation (unless you abide by the group delusions that rationalize sports bullying as ‘character building’ and ‘team building’).
Consumerism has capitalized on radical neotonization and individualization of everyone: making humans dependent on systems exploiting every lizard brain weakness for profit. People are no longer allowed to question the meme of jobs, stock market, college, patriotism, cars and houses: all forcing us into debt/wage slavery even when we are making hundreds of thousands of dollars every year. Family (life) is something you buy after buying a car to drive to a job to buy a car to go to the mall to buy clothes to get a new job.
“If the individual’s wants are to be urgent they must be original with himself. They cannot be urgent if they must be contrived for him. And above all they must not be contrived by the process of production by which they are satisfied. For this means that the whole case for the urgency of production, based on the urgency of wants, falls to the ground. One cannot defend production as satisfying wants if that production creates the wants.” -J.K. Galbraith
https://msuweb.montclair.edu/~lebelp/GalbraithDepEffect1958.pdf
Your point about education and healthcare is exactly that: the production is used to defend the wants and the costs. Neither is critical of a bigger picture of human behaviors or future human needs (beyond getting a child a job in 12 years or more). We neglect to criticize the biggest education system in the world: advertising. We don’t even get catalogs from companies anymore. That used to be the best place to learn about technology. Everyone thinks Google is God because they can search for anything, but if they know nothing, they don’t know what to search for, and that’s exactly what they usually get.