I've basically made a career out of fixing legacy codebases to give them new life, and this is completely wrong.
- The first way you see to solve a problem usually isn't the best way. It can take having code in the field and seeing how it's used to gain important insights into how to make it better/more maintainable.
- Libraries go out of support, so if you don't upgrade your code to supported ones, you may be stuck with an entire chain of old dependencies.
- Often codebases were started when a technology was new, with people who were not that familiar with how it works. Going back and rewriting that code (for example, React code written as if it were C#) will increase performance and maintainability.
As an aside, I almost always catch multiple bugs that were there, just no one noticed, while rewriting old code.