And meanwhile we select by willingness to go through basically hazing on top of inteligence. And meanwhile we routinely have doctors to perform in severely sleep deprived state too for no reason at all.
That's enough for a minimum baseline of quality. Medical school in general is hellish enough to drive people to actual suicide and there's plenty that can be said about that but at least stupid people can't get into these schools.
It could always be worse. It could be a pointless system that inflicted hell on students and minted shitty doctors!