IMO the web today is kind of like a shared OS that desktops/smartphones/even consoles can access, and a data transit system that everything can access. And I really like this.
Of course most webpages are just documents (e.g. blogs, threads), which only need HTML/CSS/minimal JS. But honestly, having the ability to just type in a URL from any device, anywhere, and get random data, or even a full application, is amazing.
Also, HTML/CSS/JS has evolved and added new features to fix a lot of what was originally bad design. And we have tons of libraries to fix essentially everything. You can write Kotlin.js/React/TailwindCSS and be programming in almost a completely different system.
But a big issue with the current web is all of the legacy content. Everything still has to be built on top of HTML/CSS/JavaScript, and most of their quirks from the old days still have to be supported. From my basic understanding of networks I also assume HTTP/TCP isn't ideal.
---
So if I could "reinvent" the web, I would make it a VM. Like what the JVM kind of tried to do. Although I would absolutely ensure that this is a security-first VM - optimizations (maybe of "trusted" bytecode) can come later, but first we need security over speed. Every site would basically be an executable.
But on top of that, there would be common languages and environments similar to HTML/CSS, React, etc. (of course hopefully improved), which compile into this bytecode. A compiler that creates bytecode which basically says "this is JSON (but actually a better, more compact version of JSON), here it is: 001000...)", and the VM would be designed so that this compiler is nearly instant, the data is compact, reading is nearly instant, since this would be common. A DSL and/or design app specialized for making blogs, another for forums, another for splash pages, etc.
And of course the web would evolve. We would probably get things wrong at first, so new languages / tools would come out later. Compiled "websites" would have a version number and the bytecode itself would upgrade, bytecode v4.0 would probably be a lot different than bytecode v1.0. Like how the web evolves now.
Except we'd be much better at "dropping" legacy features (since we can upgrade the bytecode OR tools), and have no more weird stuff to support. Hopefully we'd also have better tools for creating common websites than we have now, and these tools won't do weird things like e.g. simple blog posts with insane amounts of JS and polyfills.
Also a drawback is that bad code like malware and advertisements might be harder to spot, because it's bytecode not JavaScript. But honestly, JavaScript is already obfuscated and the code does weird things to hack / track you. And I need to reiterate, the VM would be security-first: potential dangerous or tracking operations would probably have special bytecodes or something to make them easy to spot, and they would need to request access which browsers could deny.
Anyways, that's my ambitious idea on how to reinvent the web. I'm sure something like that has / is being tried, lmk if you know something.