I'm 24 years into my career now. I think you just get used to this after a while.
I've worked on several big (at the time) software products that our company built and shipped to customers for a while, that we have since abandoned. And in those cases, the entire organization within the company that owned the code was disbanded, so there was no one left to know about it or care about it. I'm not 100% certain but I strongly suspect that there is not a single copy left anywhere in the company of the code for those products - code that I worked on for years.
It's strange thinking that there is basically no trace left of something that I put years of professional work into, but I think it happens more than most people realize. I suppose it's no different than startups that fail and everything disappears.
I also think this is why so many software people end up enjoying hobbies that revolve around physical things, like woodworking or restoring old cars. Having some physical object that you can point to and say "I built that" is kind of nice compared to everything else you've done living on a flash chip somewhere.