You can criticise Apple for many things (and we all do) but not for the length of time they support older phones.
I just upgraded to a 12 Pro Max but had my previous 6+ for 6 years, it got an update for something or other a couple of weeks ago despite being on iOS 12.
My daughters SE classic is working quite happily on iOS 14 and I think that model is also around 6 years old although she's only had it a couple of years.
Only place you get near that in Android world is pretty much with Android One which gives 2 O/S updates and 3 years security. Although I think I read in another article that Samsung is now starting to promise long-term-support for their current models.