More importantly, these 40 MB of code and resources expand to about 400 MB in memory when the application is running, but a global library wouldn't fix that.
Only if you had installed 750 userland programs. Which are quite a lot. And even then, 30GB for your OS + your third party programs is negligible in even a 265GB flask disk (merely 12% of it).
>More importantly, these 40 MB of code and resources expand to about 400 MB in memory when the application is running, but a global library wouldn't fix that.
Not sure where you got those metrics. Code doesn't "expand" on memory, and binary size it's not a reliable metric of how much memory it will use (a trivial 5 line program that just mallocs can use TB of memory).
For the majority of very large programs, most of the size on disk is assets, not compiled code.