Education of the masses did not become commonplace until the mid to late 19th century. I think Foucault has compared the school setup to the early factory and present white-collar office. In this respect it models the inevitability of a labor-force molder. I suppose it depends on reality and ideal. I have the impression that in most American public schools there is a strong tendency to promote conformity, feel-good history, pride, and patriotism.
Education can be many things.
It can be an intellectual endeavour, vocational training, or citizenship manufacturing. One thing is for certain, within a predominantly capitalist system, the tendency for the reproduction of capitalist relations of production through schools is necessary.