Salary isn't traditionally what motivates people to study medicine. It's prestige. The difficulty is part of the prestige, which is probably why they still do things like memorize long lists of cranial nerve names. I haven't heard that they have a problem with dropout rates.
A good CS education only gives you prestige with fellow nerds.
I actually think prestige is a contributing factor for CS as well. People assume you must be smart to be a software engineer, and FAANG companies are prestigious to normal people because they have name recognition. Definitely not on the same level as a Doctor/Surgeon/Lawyer or whatever but certainly could be more than a typical 4-year degree will get you. And I suppose there's also the fact that those companies were viewed very differently 10-15 years ago and now there is a lot more cynicism about big tech in general.
Yes, prestige, perception of self by others, but certainly salary and job guarantee are attractors to medicine. First hand anecdata from educators and doctors alike supports this.
A good CS education only gives you prestige with fellow nerds.