I told myself exactly what you just said. That this thinking was effectively the "sunken cost fallacy".
In the end it was about prioritising my personal satisfaction and 'happiness' over what a more conservative mind would think 'I should do' (one aspect of which was the financial sense). I am not super rich nor super successful at my choice of profession now (partly because I'm 10 years older than everyone else in my position right now, which can be an issue in itself), but I largely enjoy what I do despite the stressors and pressure that my particular position puts me in, and I'm trying to use my richer experience to 'catch up' career-wise as quickly as I can, so to speak.
I's not a black and white decision of course, and I'd be lying if I said I have zero doubts. There are still moments where I think "what if I hadn't left". Would I have been happier staying miserable but with lots of money to choose my preferred form of misery? :p
Is it better to be 'poor' (by comparison) due to cost of the 10-year career lag in the new field, but in a more fulfilling profession? In general, 9 times out of 10 when I think about it I'm happy it was the right decision and not one that I regret. But there's still that 1 in 10 which nags you, especially when you get together with your old colleagues who are driving ferraris and talking about how delicious that £1,000 champagne bottle was last week while skiing in the Alps. (I actually despise that lifestyle, but for some reason it still stings when it's rubbed right in your face...)
As for how I made the decision to leave, for me the big moment was when I realised I was bound to rebel sooner or later, because my psychology, sense of satisfaction, social life, and quality of life were all crap. This gives the sunken cost fallacy new context: your options are not just "not leave" vs "leave now". This in itself is the fallacy of the false dichotomy! Other options also included "endure another 10 years before giving up", "endure another 20 years", "endure another 30", and so on.
So the question got reframed into "leave now and waste 10 years of medicine? Or leave in 10 years' time and waste 20 years of medicine?". Similarly, "If I leave now, do I still have a sporting chance of achieving something meaningful in the new field before I have to retire? How does this change if I delay this start by another 10 years instead?"
It was easy to make the decision to leave right away after that. :)