Ancient software has been built on layers of undocumented requirements. Even if you could magically find the capacity and budget to refactor it all, you will encounter inconsistent behaviour.
You don't want to be the guy that migrates missile silo software to run on docker.
You will confront business stakeholders with inconsistencies and false assumptions. Ancient software often works like modern ML where the results could be accurate but the method is mysterious. No one wants that.
What people want is for the damn thing to keep on running. That will become increasingly more difficult once the fortran and cobol crowd head into retirement.
Young folks: if you want to be dangerous later, learn how to wrestle with ancient code. Learn refactoring and legacy languages like fortran and cobol. Learn their build systems and hardware. Learn how to interface them with with the 21st century. Because the government is not going to move to nodeJS and Citibank will not adopt dotnet 8 any time soon.