In my limited experience (enterprises like energy companies is the biggest tech areas I've worked in, code order of magnitude <1M LOC, at best a few hundred engineers), as a senior developer the best thing you can do is create a culture, good examples, and automated checks and balances. Linters and code formatters, procedures, good examples (because in that kind of world most code is copy/pasted from something similar and adjusted), and nowadays, AI prompt documents that give these tools hints to what code should be used as an example.
But even then, given time and number of people, bit rot and a slow downwards spiral feels inevitable. Which is why in those industries they will often do a rewrite every 5-10 years, especially in front-end. Often a redesign / rebranding (also every 10 odd years) will be used as an excuse to rebuild software entirely.