I bought an M2 iMac for my parents. It’ll last at least five years for them - likely closer to 10. At that point, I’m happy to recycle or donate it and get them a new iMac - likely with some major updates (form factor? Display? Etc?) that wouldn’t get with a RAM / CPU upgrade.
Spending ~$150-$300/year for them to have an easy to use & fast computer feels very worth it for me.
All that said - I would love for the machine to be upgradeable as well! Just explaining why it’s not a dealbreaker.