The developed countries don’t just face population stagnation, but rapid depopulation. This is happening today.
Given that robots cannot give birth to children today (or in the near future) and cannot go to war, I don’t see what is a viable option for those countries that want to close their borders today to protect their “purity”.