This isn't just the hardware makers, its also software makers.
A ton of the software gets sunset on older versions of Android. Older OnePlus phones, Sony and Google phones are being repurposed for Ubuntu Touch or Sailfish OS because many apps will only work on a specific Android version and up. Same thing with the Google Play store. If you have an older phone that works fine - that's great, too bad none of the software can run on it because modern apps are bloated, you need 12GB of RAM on your phone now. Oh sure you can technically run it, but it won't rune well.
I have three or four Windows phones that still run, but are completely worthless because the software can't be updated because the only browser that you could use was Explorer. Now that MS upgraded to Edge, these phones are worthless. Same thing with the Windows apps. I was able to use One Note on my Lumia 950 just as a stand alone note taker, but now it won't update because MS says it doesn't support that older version and I can't update it.
I agree 100% hardware makers are one of the reasons, but there's a massive issue with the software makers who do the same thing and essentially stop supporting older versions of their software that run fine on these older devices.