>not quite sure how to reconcile this with inspections of migrants around the turn of the 20th century, even if those were more focused on public health and stuff
More than public health. Every single migrant who came through Ellis Island and other US border stations had to
* Pass said public health examinations
* Prove, to the satisfaction of inspectors, of disaffiliation with a variety of subversive organizations/ideologies (Communism and polygamy being two prominent examples)
* Provide proof of financial support in the US, whether by oneself or from a US financial sponsor
Don't pass any of these tests? You're on the next ship out of the US. Shipping companies were responsible for return passage (just as airlines are responsible for paying the way of those who do not pass US border entry today), so had incentive to make sure that their passengers would pass scrutiny.
I am a migrant to the US. I am very much in favor of restoring and enforcing such rules today.