One of the few things I remember from my IS management class in school was learning about Nike's massive ERP failure. If I remember right between the initial cost, lost sales, and money spent fixing the issue they lost $400 million and their stock price fell 20 or 30%.
Switching costs and risk are the major reasons these systems stay around forever. If you've got something that works. Even if it's sub-optimal, you're never going to move away from it. I worked at a place that used an ERP from a company that went out of business, so they would install DOS emulators for a really ancient version of DOS on every computer for people who needed access to the ERP. This was seen as a better solution than the perceived risk of switching ERPs. This was 10+ years ago, but to my knowledge they're still doing this.
Four years ago I worked at a company in the Fortune 500 that still used DOS for their main system.
As you say, the switching cost is way too high and dangerous. They moved billions and billions of dollars daily through a highly complex structures and complex laws in different jurisdictions across the USA. The business logic was built over the 40 years when the world was DOS. It's not like they are dumb and don't know linux or Windows exist and all that.
They brought in huge consulting companies all the time to see if they could get it upgraded, but no programming house, no consulting company would touch it. These consulotants turned down hundreds and hundreds of millions of dollars, because 1) it was just too f-ing complex, and 2) if they messed up, the liability would be immense because of the dollars daily transactions, and what the dollars were used for. It would be an absolute shit-show of the first order if things were to go sideways. I'm positive that these consulting companies E & O (errors and ommissions) insurance company would refuse to insure them. Doing it wrong would be catastrophic on a corporate, but also national level. It would not be a matter of some stick-it notes from 3M not getting to the stores on time, or shoes getting to the shoe stores.
Switching costs and risk are the major reasons these systems stay around forever. If you've got something that works. Even if it's sub-optimal, you're never going to move away from it. I worked at a place that used an ERP from a company that went out of business, so they would install DOS emulators for a really ancient version of DOS on every computer for people who needed access to the ERP. This was seen as a better solution than the perceived risk of switching ERPs. This was 10+ years ago, but to my knowledge they're still doing this.