But universities really make you push through those things you are not motivated enough to do (and subjects that seems to have no purpose) and many times you find out it was fun after grooking it and it actually made a lot of other things way easier. The first week after the exam you might be upset over the exam, feel something was unfair, but eventually those feelings fade away and you have another telescope to view the world through and arguably you have gained some grit. The universities are a guiding hand off what the experts in their field find important to know.
It's a bit like ordering the chef's choice in a restaurant. Sure you might hate a piece and never come back, but you might also find new combinations of flavours that you start to love but looked tasteless.
Anyway how many of us haven't felt great because we can code and suddenly we are more logical? What happens when you suddenly start to study logic or even learn something extremely simple as De Morgan's laws [1]?
[1]: https://en.wikipedia.org/wiki/De_Morgan%27s_laws
PS. I would also say that good universities are very, very different from high school. When the professors say something, they've studied it for years so they use precise language and are strict in their teaching. Definitions mean everything for them and you can't just say language is fluid to score a point which seems popular nowadays.
PPS. University is free in my country, so I don't consider cost-effectiveness to get a job. Especially as it seems pretty much anyone can get a coding-gig (we had a hot-shot consultant from a very prestigious firm (if you have lived in US, you've heard of it) ask me why his CSV file wouldn't work in our software. He had just taken an Excel-file and renamed the file-ending to CSV instead of exporting it! He could code, it was just that his knowledge was very, very shallow. We where quite expensive too).