This thread is discussing a phone with replaceable battery. For at least 5 years.
I think the relevant question is whose phone lasts 6-7 years? Because you might well replace the battery a couple times over the life of the phone and that's fine.
Anyway I just got a whole new iphone 8+ out of a failed battery replacement and it was showing all kinds of OS and application glitches, just as the moto G I had before it did too. The flash and DRAM doesn't last forever, the practical lifespan of the handset itself is about 3 years for complete stability, 4 years for moderate glitchiness, and 5 years for complete unusability, same pattern across both phones.
But yes, this means I will be using a 2017 phone for another 4 years, so the software lifespan probably needs to be close to a decade, and Android's lifespan is absurdly far from that level.