It isn't that they are crappy web devs. It is that often the org paying for the development doesn't care.
I am a web developer of over 20 years. I can create insanely optimised pages using nothing other than vanilla CSS and JS.
I have been paid exactly once to do this. There is a site I built in 2023 that has a JS and CSS footprint of less than 100KB after GZip (large site). We even had the Go templates compiled when the web app initialised so the server responded as fast as possible.
Guess what happened when it went live? The content team use 8mb images for everything and every single optimisation I did at CSS/JS was totally useless.
Devs don't care because the people above them don't care and therefore there is zero incentive to even bother.
> therefore there is zero incentive to even bother.
I hear you, and this is a real problem. But it's kind of depressing to need incentives to care about the quality of your work.