My plan: (1) Stop all aid to countries that refuse to take back even one of their citizens. (2) Slap a fee on money transfers to those countries - 1% if they are cooperating fully with our immigration enforcement, and 20% if they are not cooperating. (3) Block all trade in either direction with countries that refuse to cooperate. They will take their citizens back. Or else!
By requiring a SS card and govt issued photo ID, one should be able to see who is here legally. Use a higher money transfer fee for those who are wiring $ to specific countries.
Also, block all visas from those countries (though given that most of the illegals can just flood across the border without bothering to get a visa, most of the countries wouldn’t care about that).