My theory is that modern (post industrialization) schools fundamental purpose in society is not to educate but to prepare a workforce. They acclimate people into accepting very arbitrary rules that will be normative in the work place.
There's a lot written on this and a fair amount of disagreement. Here is a decent high level / non academic article. https://qz.com/1314814/universal-education-was-first-promoted-by-industrialists-who-wanted-docile-factory-workers