Important to note that this too big to fail point occurs very quickly in some cases. Non-IT companies are generally very risk/change averse in regards to their IT infrastucture (and for very good reason, see e.g. [1] and [2]). So if you are capable enough to learn their legacy codebase you will be very quickly the only person worldwide capable of maintaining it.
[1] - https://www.cio.com/article/274138/enterprise-resource-plann...
[2] - https://www.theregister.com/2024/12/06/birmingham_erp_budget...