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?
Qualcomm needs to maintain their drivers to make updates easy, but they usually do that for just a few years. Once they stop, updates usually stop as well because the smartphone manufacturers don’t want to do qualcomm’s work in addition to their own.
It’s a major issue that hurts android as a whole and unfortunately there isn’t an easy solution because qualcomm basically has a monopoly for high-end SoCs.