There are already discussions about that, e.g. here.
To make it short: A phone has to be small and light, therefore components such as RAM or CPU have to be soldered together, which means that you’d have to replace the entire core module, which is hardly possible, because the other modules are designed specifically for the components inside the current core module, so they probably won’t work with a new core module due to e.g. driver-related stuff (I’m absolutely not an expert in this field, I’m just writing down the stuff I remembered from previous discussions about this topic).