The idiom of ephemeral, throw away, spaghetti of dependencies was born out of the way the web platform moved forward, the short lived nature of websites and web apps, and the spread of developers with different backgrounds that were working on it all.
If we were using Javascript to develop native windows apps then I am sure the ecosystem would be very different. However, that would be dumb, right? cough
You get 90% of the functionality at 10% of the complexity, and your back end looks essentially the same as it always has, in whatever language you want.
As much as I would like to have something different for the browser (such as Scheme, as originally envisioned, or Lua, which would have been a better fit), the world has moved on.
Only hope is to compile to javascript or webassembly (or "transpile", as js folks like to call it).
Now wasm has our hopes up again but without direct dom access.