If schooling and learning/education are truly mutually exclusive then who is the most learned and educated person you can point to that never stepped foot in a school? And how do those rare examples compare against the breadth of modern PHD holders?
There are a non-negligible fraction of kids that are kept out of school, homeschooled, etc. If school was as bad for learning as you suggest then one would expect those kept out of it to demonstrate higher-than-average aptitude.
How big is that fraction? In my experience being around a bunch of home schoolers (and adjacent, and school system), some of whom were more in or out of unschooling, I think it's small enough that it should be a rarely considered option.
There are some kids where it will work _really_ well. I've interacted with a couple. There are a lot of kids where it really doesn't work, especially in a distraction rich environment.
It is also and equalizer. Unschooled kids from bad backgrounds now start even lower.