It's quite rare for this to be possible in any component of anything you buy these days. Why single out EV batteries here?
In EVs though, replacing the battery is so expensive - thousands of pounds/dollars - it makes no sense to do it. So once the battery starts degrading after only a few years, the upgrade is incredibly expensive - essentially the cost of a car.
If by doing so you could at least extend the range and see a benefit, perhaps it would make sense. And why couldn't you do it. Because its a design anti-pattern. If you stick to a certain space in the car for the same model, you could easily make this a feature. But you wouldn't if you just want to sell cars.
As it is, I think these cars will have a shorter life span than non-EV cars - they will be scrapped earlier as they are not economically viable. I don't see how they not far less environmentally unfriendly than non-EVs.
The scenario is that an old battery can only store so much charge, which limits your range. However newer versions have better batteries and therefore longer ranges.
The kicker is that the better battery cannot be fitted into a perfectly functional older car.
Don't forget that the functionality of older batteries decreases too, with a loss of range. So you can fork out for a very expensive battery but it is for the old version only. Feels like a lose-lose scenario (expense and poor range).
Frankly the electric car economics in general don't make sense for anyone that actually needs to cover some miles - the older cars lose range and will be an expensive headache in the future, and the newer versions are way too expensive for what they do.
That was my analysis anyway, when I looked into buying a second hand EV.