It may be true that hard-hard parts will be unavailable, like gears and housings. Hydraulic pumps are more easily "aftermarketed" and aren't usually made in house anyway, are they? 3D printing is all the rage among the rest of the world that doesn't appear on this forum (you know the type, the ones who don't do anything). I'm not holding my breath on 3D printing, but either that or a little artificial inteligence built into a CNC machine shop may change the landscape for obsolete parts.
I'd bet there are already bootleg brain box suppliers out there, you just need to know where to look, and maybe speak chinese (or click on the Tshirt links:falldownlaugh).
It's not just the cost of repair, it's the cost of repair vs new machinery replacement cost. Somebody will keep it going one way or another if there's the demand.
I certainly agree that some equipment is more likely to be operating than others at 30-40-50 years old, and that OEMs don't care, they're selling new equipment mostly to people that will use them and sell them off quickly. The very early tractors that survive are curiosities only, the Fords and Farmalls that had the kinks worked out are still around in hobby use. Same with vintage Cat dozers or Deere tractors that still sell for a similar premium over scrap as some much newer equipment.
Think of the types of machinery you don't see being kept for use these days, the first steel wheel tractors, very early hydraulic excavators, old scrapers, steam engines, shovels, locomotives, horse drawn combines... Does anybody here know who built the most long lasting horse drawn combine?
Cars have transitioned to electronics successfully in my view but there were some ugly adolescent years(decades?) in there. I don't know enough about modern diesels but I suspect the last decade will be seen the same way for diesels.
In any case, the problems of electronics and emmisions may not amount to much a few decades from now, either they will have been all worked out or we'll be relaxing while "Wall-E" does our old jobs.