There really does not seem to be any specific rule that manufacturers follow; it seems to vary greatly according to how much demand there is for a particular component. The manufacturers make good profits from selling replacement parts; as long as tehy sell enough of a particular component to justify manufacturing and warehousing it, it will likely still be available.
Even after a part has been discontinued, there are usually a lot of that particular part number in the warehousing and dealer inventory system that are available for purchase.
I've never had much of a problem purchasing anything I needed for a Mercedes from the dealer even for 10 year old models. Most vehicles are designed for a 7 to 10 year life expectancy; anything older than that is where you usually start to run into parts availability issues (on any make of vehicle).