Its generations not phones that matter.
It's not generations that matter either. What matters is the hardware capabilities and the ongoing difficulty of supporting older models with significantly different hardware. (This is why support was dropped early for the Galaxy Nexus: the OEM for the SoC exited the market and made it all but impossible to get updated binary drivers for the GN hardware which would work with kernels later versions depended on.)
The reason why people are rightly upset with this decision is that there is very little hardware difference between the Nexus 5, which is not supported, and the Nexus 5X, which is, making this an arbitrary cutoff most likely motivated more by marketing and an attempt to drive people to buy newer phones (when their old ones are working just fine) than by reasonable technical constraints.
Oh well. There are always 3rd-party ROMs. As small as the hardware differences are it shouldn't take long for someone to port AOSP 7.0 to run on the Nexus 5. It would just have been nice to be able to rely on a reasonable level of ongoing support from the original vendor. Other operating systems, and especially ones based on Linux, tend to run just fine on hardware far older than three years, and smartphone specs are no longer improving at so rapid a pace that a three-year-old device can be presumed obsolete.