The governments set the immigration policies. They probably think it’s easier to import doctors than fix the problems with medical schools, hospitals, doctors guilds, payment systems, ect…
It is very uncharitable to view this as an attack on immigrants.
They voluntarily immigrated to the country to take highly skilled jobs and are free to leave at any time. They are not victims; they are willing participants in an exploitative system.
People with limited choices can still be victims even if they volunteer.
You're kinda ignoring the part where the exploitative system is global, and those people are coming from places that are on the more exploited end of it. The reason why they come to take those jobs is because of the quality of life that comes with that, that is impossible to achieve in their home country. And the reason for the latter is largely because their countries have historically been exploited by the one they're now coming to, and in many cases, are still being economically exploited in various ways (including directly sponsoring local political corruption by foreign businesses). If you don't want them to come to your country to chase a better life, raise the living standard in their country.