Not completely true.
Apple promises all customers 5 years of hardware support past the last day the model was available for sale, and at least two years of limited hardware support thereafter.
In the UK, for iPhone 15 and later, Apple promises at least 5 years of software updates from the time that model was first offered for sale.
I would assume similar schedule outside the UK as well, but afaik it is only explicitly promised in the UK, due to regulatory requirements there.
For enterprise customers, Apple guarantee a minimum period of software security updates for macOS, but the exact period is kept confidential in the specific agreements.
Like the UK iPhone commitment, I assume the enterprise macOS schedule apply to all customers, and Apple just avoids publicly publishing it, I would guess to avoid some legal-induced headaches (which I personally think is the worst excuse, but I digress).