Schools were a great invention, and became quite well optimized, even in the absence of a theory of learning and development: For instance people put children of different ages into different classes (a massive improvement) and then saw the pattern (group by ability to teach effectively), and within ages had different ability levels in different classes, and routinely promoted or held back kids across years.
In the private world where people are paid for performance, we still do this: Your ski class will grade you by ability, ignoring age, then freely move you around during the week if your rate of progress is greater or lesser than expected. It works.
State-paid teachers, however, hate this. I don’t know why. How do they know to hate it? It causes the best learning outcome for all pupils, shifting the mean up, and probably not doing a lot to the variance: The bright kids will leap forward, but the less able kids won’t fall behind anymore, so I think overall the spread will be comparable.
I can understand why teachers want small class sizes: despite this the most expensive way to achieve the smallest of impacts on learning: It is just nicer to teach 10 kids than 30. But I don’t really understand why teachers go to the wall against streaming and setting.