Yes, you are right. Some children will need to be institutionalized for their schooling.
We need orphanages, too, but no one argues it is the best way to rear a child.
in the 50’s and 60’s I had occasion to visit several church run orphanages and I was very favorably impressed.