Apple seems pretty good at keeping old phones up to date. The iPhone 6S is still supported, which was released 7 years ago.
I agree that their support is the best of the smartphone vendors, but I would also welcome legislation that opens up hardware for arbitrary software at EOL.
When Apple decides it's done updating the 6S, I should be able to run Android or Linux on it. But they've locked down the hardware so it can only run iOS.