The iphone doesn’t just die after 5 years.
I still have a 10 year iPhone 6 and a 8 years old iPhone 7 both still working just fine.
Apple stopped releasing OS upgrades with NEW features, but they are still releasing security updates. (In this aspect it’s better than most (all?) modern TVs.
Those iphone are still working the same way as when they were released. The only issue is that some apps doesn’t works anymore.
So part of the blame is on app developers.
Sure, maybe the app needs some feature which the old phone doesn’t have, but more likely is that the company just can’t bother to maintain their app in older OS versions.