I think it depends how the exams work, specifically whether they encourage a useful mixture of rote learning and information analysis.
When I was doing my medical finals and my specialist exams then it did feel at times that I was simply swallowing and regurgitating info that I would never remember in future, but this wasn’t correct - much of what I learned for my finals 22 years ago is still with me now and I don’t think I’d have them burned into my long term memory if I hadn’t had to prepare so completely for my exams. I’ve basically never had to use my knowledge of lysosome storage disorders - they affect fewer than one in 10k on average and I’ve maybe seen one case in my life - but I still remember them, know they exist, and know how to look up more information about them.
Basically, I don’t think you should be allowed to be a doctor unless you’ve passed comprehensive and rigorous exams. Sure, take them several times if you have to - I’ve failed several exams too - but you need to retain and be able to use that information.