The team at the Android Open Source Project is working on a feature called “hibernation”, which will reduce the memory footprint of apps you are not using. This feature is still in the early stages of development, but may be included in Android 12 (no official release date, but the Developer Preview of Android 11 came out in February 2020).
What’s hibernation, anyway? Well, if a single user of a multi-user device chooses to hibernate an app, the app cache associated with that user will be cleared, freeing up a bit of space. That is already implemented.
The more interesting question is happens when all users of the Android device hibernate an app, especially since most devices have only one user set up. Since it’s not implemented yet, it is not clear what the OS will do in this case.
From the name of the feature, it sounds like the app will not be permanently uninstalled, but there may be a way to compress it to save space (along with the usual cache clearing). Later, it could be uncompressed if the user wants to wake the app from hibernation.
Note: this hibernation feature appears to be completely unrelated (besides its name) to the hibernation function offered by some apps and Xposed modules, which pauses app execution similar to Android’s built in Doze state.