I mean whenever you load a page with JS, you execute arbitrary 3rd party code.
I agree, the philosophy of "why not?" needs to be turned into "why tho?"
Yet you are using web atm, and in fact executing tons of JS.
While I am myself not a fan of current status of web. It would be a shame if web never existed. Without it I would never learn to code, I wouldn't be able to talk with tons of people, and I wouldn't be able to shitpost.
I agree about spying, hell I use uBlock and Privacy Badger, and sometimes even Tor (I see no point in using Tor when I am going to authenticate in the end). But overall web can be a great thing. We just need to try and win it back.
And in the end the worst problems aren't in the efficiency (or lack there of) and RAM usage. It's exactly what you're talking about. The biggest problem with web is not web, but people who use it. We, as users, let it become centralized, which in turn let it to be used for surveillance (or at least made it easier). We traded privacy for convenience.
We, as in devs, got lazy with software, we default to "hardware will get faster" and "works fine on my machine with 16 GB of memory" instead of actually looking into a problem, profiling and optimizing. I get why though. in the 80s we had constrains, now, not so much.
So in the end, even though I have a beef with web (fuck even whole internet) on tech level. I much more have a problem with it on political level, which is only fixable by people, not tech.