How many people do you know who know things like statistics, analysis of algorithms, discrete math, calculus, to the same level as someone with a Master's degree in math or comp. sci. and just learnt that by watching YouTube videos from Stanford or MIT? I know some people (including myself) who got some exposure to some of this without getting a degree (I got one eventually) but finding someone as well rounded as a good curriculum is very rare.
Watching videos is more like thinking you're learning. In order to learn you need to practice and internalize.
Now you might argue all this stuff doesn't matter. And if you're just cranking out some mundane code maybe it doesn't. But sometimes it does. I'd imagine it'd be hard being a CTO of in a deeply technical business without having the in-depth theoretical knowledge but CTO can mean lots of different things in different companies.
All that said universities are far from perfect and their curriculum is a mixture of practical and theoretical trying to balance preparing future researchers and scientists and preparing the future workforce. Software development also tends to be very diverse. I do think software developers need some of this background and unfortunately it's much harder to get it without going to university...
The other thing is IMO universities can't make someone who has no aptitude to software a good software developer.