I work on software that has a lifetime once installed of about 30 years, and if a safety critical error is found during that time, ideally it needs to fixed with a minimal patch, so we have to maintain the capability to do so.
I guess the ethos is quite different to top tech company. We don't get the pay or perks that you would get in Silicon Valley, but we are unionised, and it's a viable option to spend your entire career just on one project so it's very stable.
Partly it depends on documentation, but also on thinking long term. There are certain people who are the technical authority for a particular area, and they know that about 5 years before they retire or move on they need to find someone who can take on their role for at least the next decade, to keep their knowledge rolling forward.