Additionally these machines do not cease to work once Apple declares them obsolete and there is nothing stopping someone from installing Linux on them and continuing to use them with a supported operating system that way.
Currently Apple is reaping all the financial rewards and taking responsibility for very few of the externalities. Does this mean it's what's best? It might seem like a stretch today, but in the medium to long-term, true sustainability is important.
Apple could at least (1) not cripple the devices software and (2) coordinate with a generic manufacturer or supplier to provide replacement parts and competent service and/or updates.
Apple could surely dig around the couch for some spare change and locate the resources to make this happen.
They do not publish the drivers though, which means groups like Asahi have to waste their life-hours reverse-engineering for sustainability purposes.
Apple just has the decency to communicate what hardware it considers to be officially obsolete.
Let me reiterate, what computer manufacturer provides Apple’s level of support for more than 7 years?
Also, keep in mind that even if Apple did continue to invest software resources into the older machine, the application vendors probably wouldn't as it costs them money too. And applications can have security holes and breakages just like everything else.