Apple controls their entire supply chain in a way really nobody else can. That's how you can order a BTO device and get it manufactured just for you within the week and out the factory doors a couple days later.
For stock that's already been manufactured and isn't to be sold anymore - they'll simply keep it in inventory for (warranty and paid out-of-warranty) replacements. Not like you can tell if your replacement is refurbished or brand new. And when it's been sitting in a box for a year and more there isn't too much difference either (the battery will degrade a bit).
Apple has AC+ plans that cover iPhones for 3, 4 or even 5 years. So if you smash your iPhone 12 Pro to pieces in 2025 and walk into an Apple Store you'd expect them to be able to replace it. Apple would rather give you another 12 Pro instead of being forced to give you an iPhone 17 Pro for free.
You gotta keep in mind that Apple pays a couple cents manufacturing for each dollar the customer pays Apple. So Apple will make more money not selling that extra stock of older Pro phones immediately, so that they can instead sell more of their latest and greatest iteration.
That's the whole point of removing the older Pro devices from the Apple Store, so that these don't cannibalize the sales of the latest phones. Otherwise Apple would have to reduce the price for these older models a bit, which means fewer 14 Pro devices sold.
If Apple could take the older Pro devices out of retailer's stores, they would. The only reason you can buy an older Pro phone later is that Apple can't run the retailer's businesses.
I bought a 11 Pro Max brand new in February 2021, which was well after launch
They are talking directly sold by Apple, Apple only sells the latest Pro iteration.