I was taught how to code from early on (6th grade), and most of my learning of programming (which I would distinguish from computer science) happened as we worked on projects/built things.
I can't tell you how many times I saw other students get stuck on bugs along the way during development and get really frustrated with programming (I saw this when I was a student, and later when I taught others how to code).
What always helped was having teachers/instructors who could easily help students work through those roadblocks so they didn't get stuck and holed up on one thing. Not really the traditional teacher that just stays up and lectures at students but rather one that also spends time getting in there and working alongside them to some extent.
Traditional classrooms/lectures are structured from the ancient days where students went to listen to a professor speak and jot down whatever the lecturer orated. But now, especially with programming, the emphasis is more on building, and so that changes what the instructor really does in the classroom (just "lecturing" vs "facilitating" and "supporting").
Probably a long-winded way of the same point you just made, but I just thought I'd elaborate since it's interesting to me. Some of my friends say that these online courses are 100% independently viable but I am not convinced that they are a suitable replacement for teachers (though I recognize it really depends on the students and how independently motivated or how prone to getting burned out they are...).
Just my 2cents...