It feels like some sort of a tree shaking solution in most of our modern development stacks is long overdue.
If only we could get rid of dynamically called code and instead could evaluate which code paths the code actually can call, then we'd be able to throw out about 90% of the contents of libraries, since most of the time noone actually uses all of that functionality.
Doing that with separate scripts is another approach, but it feels like the problem should be solved at its root.