> if the child values learning
Big if there. Kids aren't really the ones who understand the value of learning. Give a kid with the ability to read the Internet and say "have at it" will probably not result in an educated child.
It's also entirely possible to take a child that values learning and drive that out of them through discouragement and disincentive, something schools are often quite good at.
On the flip side, it's entirely possible to encourage a child to value learning. But that's something that tends to happen early, far before school, and even if present, may or may not survive contact with school.
A good teacher can do it, at least for some children. Teachers that good are rare, though.
All of these were and still are statistically predicted by children's origins.
That is, that's all it takes if the child values learning. If not, well, plenty of children manage not to learn in schools, too.