From Feng Menglong's Ming-dynasty story collection 《喻世明言》, volume 18: 此去也是万不得已 — a wife parting from her husband explains the trip is unavoidable. Literally 'in 10,000 ways unable to stop' — stop at nothing short of doing it.
grammar
Common patterns: 万不得已 + 的 + noun (last-resort X), 万不得已 + 不 + verb (wouldn't do it unless unavoidable), 到了万不得已的时候 (when things come to that extreme point).