More technical debt comes from growing quickly (engineers, turnover, employees) and changing business assumptions, not the programming language.
The prebuilt libraries are the main advantage Ruby and Python have. A converter for them to new languages would negate that, though.
And there are many good engineers who are well versed with the language.
While something like kotlin has a small learning curve and gives you a lot of the benefits of scala. And it's backed by google, jetbrains & the investment that goes into android. Most people understand ADTs, nullable types, lambdas and data classes fairly readily.
I think it basically comes down to a company making a system out of a dynamically typed garbage collected language of either php, javascript, python or ruby, and suffering the perf issues (~8x slower than C/C++) and lack of type safety that it gives. Also those languages typically have ecosystem issues as far as the robustness of their libraries go (like javascript).
A more mature company settles into a typed GC language (Java, C#, Golang) and a typed static language for perf benefits when needed (C++, Rust). Yes there are typed versions of various dynamic languages now, but you don't get the speed benefits that the typing gives you, and a large part of the library ecosystem that you will interact with will still be untyped under the hood.
See Rails callback hell as an example.