They are maximizing shareholder value though. Each OEM is competing with the other OEMs producing for Android, and creating a new Android update for the older phones doesn't increase sells if another OEM releases a phone that has better specs in addition to having the newest OS.
Whenever any of my friends go shopping for a new Android phone, they immediately try to find the one with the highest specs. OEMs aren't going to waste time releasing an update for a phone that won't make them money anymore, they're going to spend time instead on making better hardware that will make money.