This is a debatable position. Linux distros usually do this, but a lot of modern applications ship with all their dependencies. I'd say the former is more efficient and generally better from a user perspective and the latter is more stable and is generally better from a developer/maintainer perspective. Open source encourages the former, proprietary software encourages the latter.
Clearly this can't be enforced, but I've always found it bad practice to allocate memory inside a library.
For example the WideCharToMultiByte [1] function of Win32 handles UTF-16 to UTF-8 conversion. If you pass your destination pointer as NULL, then it purely calculates the number of bytes you'll need in your buffer. Then the main program actually allocates the memory and calls it again with the populated destination pointer.
[1]: https://learn.microsoft.com/en-us/windows/win32/api/stringap...
Now you can just ship the user your machine and software can theoretically be immortal.