That's the choice of the manufacturer.
If a company is selling something and says "X years of support", that means X years of support, not "until date Y" where Y is date of release + X.
If android manufacturers are saying "X years of support" when they mean "supported until [some date]" then they are quite plainly false advertising.
I can find many sites that say that apple commits to 5 years of software support from the date of last sale, but I can't find anything on apple.com that matches that. I've found that they guarantee 5 years of hardware support (repairs, etc) from date of last sale, and then a further 2 years subject to hardware availability (presumably they stop purchasing/manufacturing parts). Note that I'm not talking about warrantee coverage (which varies but seems 1 year is standard?) just the actual ability to do repairs.
Based on this article and various others over the years, and the vast array of spammy infographic laden sites making up the first page of google search results, it seems like claims of ~5 years of major updates and a few more for security only is consistent, but again I can't find anything on apple's site to confirm that explicitly.