We don't know how to teach fuckall. We basically shove a bunch of crap and resources in students' faces, and we hope that they can manage to teach themselves anything of value. Once in a blue moon there's a teacher who truly knows how to get their students to learn well (I've had more than my fair share in my academic career, that's for sure, but even so it was a tiny minority), most "teaching" is basically just cargo culting and going through the motions to "cover the material". So of course we see a pattern of folks who don't have as much support for learning outside of school tend to be at a disadvantage except in rare cases. Most education is practically coincidental to the process, a matter of osmosis and expectations as much as anything else. And in truth if you take a recently minted college graduate off the line and do some truly in depth tests of the quality of their education you'll find it sorely lacking in almost all cases, no matter their GPA, alma matter, or major.

Education is a bit like journalism. You find in journalism that whenever a story comes out in a subject you are intimately familiar with it's riddled with errors, inaccuracies, half-truths, and sometimes worse. Which makes you wonder about the rest (it's the same). In education you find that once you acquire a sound and thorough understanding of a topic you look at the way it's taught and see a lot of busy work, almost no concentration on the fundamentals, and a constant pattern of "keeping pace" even as most of the class gets left behind and typically only retains enough knowledge to pass the tests by sheer force of will (memorization, test taking techniques, and trial and error).

For me the best STEM classes in college were always the ones where you had to apply your knowledge, but those classes were too rare and not as well attended as the mandatory classes.

Unfortunately, a lot of institutional education in STEM fields suffers from several fundamental difficulties. For one there's is the common perspective that "it's supposed to be hard", and so curricula are tuned to weed out those who can't tough it through. For another, there's a tremendous focus on rote memorization, busy work, and trivia versus practical, applied, core knowledge. Real life is not like an episode of Jeopardy, the vast majority of the time you are better off with having a sound understanding of the fundamentals and the ability to look up or pick up any specifics or trivia as needed. This is true whether we're talking about CS, math, chemistry, physics, or what-have-you. Yet consistently the system is setup to reward the folks who are able and willing to suffer through most of that useless memorization and busywork and punish those who can't or won't.

This is why you see so many adults who routinely say "ugh, I haaaated math in school" or science, or english, or essay writing, or computer science, etc. Those subjects are vibrant, fascinating, exciting, rich, and interesting areas of study. Studying math and computer science can be playful, fun, and inventive. But when crushed under mountains of drudgery all of that is lost and the result is that people end up cut off from learning those things and they lose their enthusiasm for studying.