That's been my biggest gripe. There's a form of classism in the Android world where the duration and quality of OS updates depends on how much you spent. First-world customer who bought a Galaxy S? Roll out the red carpet, four years of major updates. Middle-class Indian for whom a $200 phone is a significant expense? Be thankful if we give you two years, and we might only deliver security updates once in a blue Moon.
I know part of it is that low-end phones are less likely to handle that many updates gracefully, but then that begs the question of why Google builds regular Android without seriously considering what performance will be like for lower-end phones three or more years later.
That's simple economics though; and there is a simple solution that probably doesn't work in the real world. I've said before I'd be happy to pay a nominal fee for security updates. Maybe $20 per year after bundled support ends? If a device manufacturer is selling a $200 device with razor thin margins, should we really expect them to provide great updates?
I disagree that Google isn't handling the wide spectrum of devices. They have the Android One program specifically for low-end devices. Having said that, RAM is the primary limiting factor. You can optimize the hell out of the OS stack, but there's not much you can do when a single browser tab gobbles up hundreds of MB of main memory. Also, the most important thing are timely, critical security updates. I couldn't care less that I can't put Android 11 onto an older device.
If Pixel 6 actually has 5 years of updates, and Samsung and a few flagships give you 4 years, we're getting pretty close. Personally I like to use my electronics until they die, and 5 years would end most criticism of Android updates (unfortunately it would be status quo for low-end to mid-range devices). The thing is smartphones are very mature products with minor annual upgrades, so we're getting to the point where flagship hardware is very future-proof.