In most countries doctors and other health professionals are registered and licensed, and must submit to strict examinations.
Mistakes can also be career-ending and potentially result in criminal prosecution.
It's way harder to get hired as a doctor than "do a bit of leetcode on a whiteboard".