As a point of comparison, Microsoft ships its OS across a variety of manufacturers and largely keeps it maintained across them (give or take some exceptions like enterprise environments & the like).
Even unlocked Android phones purchased independently of carriers have inconsistent lengths of support, so it doesn’t seem to be entirely a result of carriers, so…What happened here?
Your title implies that it was consistent at some point, but Android updates were never consistent. In fact, it’s actually become more consistent in recent years, since the introduction of Project Treble. Most mainstream flagships now offer 4 years of updates, with some manufacturers even offering 5 years (Google and some Samsung flagships).
Was going to say, 6 or 7 years ago you could buy a flagship android phone that might get only a single large OS update.