I've contributed almost 10k hours to 100s of projects in the last 10 years, and most of them are still alive and have only grown in adoption. (Also it would suck if all that time went into the bin a few years later!)
From my experience, here's a ranking of how long code lives:
* Proprietary "webcrap" and plumbing logic at companies. This dies the fastest (6-24 months).
* JavaScript frameworks and tools, open source. "Dies like flies" -- many of them, short intense life, then everything dies down and the buzz moves to the next swarm.
* Proprietary backend code. Lives 5 years, then gets rewritten or dies a long death.
* Open source code in dynamic languages. 5-10 years, then mass extinction events end some lineages, such as "The Tertiary Era" (Python), "The Discovery of the Fundamental Theorem of Write-Only Code" (Perl), and "The Birth of the Script Kiddie" (PHP).
* Open-source code in static languages (Haskell, C++, C). Usually around already 10 years before I started contributing, and showing no signs of getting old.
C/C++ are very stable and backwards compatible, Rust tends to be more aggressive at the moment of changing things.
Honestly I think the investments made into web technology right now are so massive and pervasive that I wouldn't be surprised if we still use something that looks a lot like the web stack in 50 years, simply because there'll never be a good moment to dump all that baggage when you're so deep in it. I don't think we can look to the past of computing to understand its future, I think we have reached in the past ten years or so a critical mass and penetration into the fabric of society that the rules are just different know than they were in the 90's.
Unless the way we interact with our computing devices fundamentally changes (say, a shift from visual/touch to, idk, voice or brain waves or whatever), I have a hard time seeing how there'd ever be a big shift from the web stack to something else like, say, the shift from Win32 apps to web apps. Hell, even if there is, the web might just embrace it. My day job is web-based AR...
The stack will evolve, sure, and maybe at the end there's nothing left and the clients won't know HTTP at all anymore... but I can just as easily see us just piling more stuff on, because I honestly think that, even with voice assistants and AI and whatever, most people are still going to produce and consume text and images from a device a lot like a phone for many years to come, simply because it's a system that works well for humans that have eyes and fingers and pockets.
And if that's the case, then what's going to cause a seismic shift in platforms, when almost all software developers are web developers, and all devices run web applications? And if the stack doesn't change, why wouldn't some of the code stick around, if the business or organization that invested in it does? Some businesses now might replace twenty-year-old code just because, but at least part of that is because of how software stacks have changed and aged, and I think the sheer amount of "webcrap" that's being excreted by people like you and me is going to slow that rate of change right down, even if it doesn't feel like that in the middle of all the framework churn.
Same goes for webcrap; I have some horrible php and jsp prototypes from the early 2000s which have been running production ever since.