Apple's long-standing policy has been to only replace parts "in kind"," meaning they will replace a defective 1TB drive with another 1TB drive, but not do upgrades that change the specs of the computer when it left the factory.
Macs are becoming more and more "closed systems." The only iMac remaining that has user-upgrade RAM is the 27-inch Intel iMac. It has a RAM door. All other iMacs and iMac Pros are sealed units and not intended for the user to open, Even some Apple Authorized Service Providers will not work on them.
The iMac is now in its fifth family with RAM and storage integrated into one unified Apple Silicon processor in the new M1 24" iMac. The storage and RAM you buy will be your "forever" storage and RAM. We do not know what the Apple Silicon replacement of the current iMac 27 will look like so cannot speculate on its upgradeability.