Yes. Probably everything you say is true. But still you don't address the moral point about discrimination.
It's as bad to discriminate against someone because of place of birth as it is to discriminate against someone because of colour of skin. If you doubt this, consider a small child needing help: would you deny assistance to a child because he or she had a certain skin colour? Some people would, of course; they'd be immoral. Likewise with denying assistance to a child based on his/her place of birth.
(To be clear, the point I'm making is not about children: that's just an example to help you understand. The point is about discrimination and morality.)
The debate about borders and immigration/emigration usually ignores this (moral) point. It's 'naive' to bring it up, we're told. But, actually, it's inescapable. Yes, it makes for hard choices. Doing the right thing often comes with a cost.
I just - naively - wish we could at least try to do the right thing and help people when they need it, no matter what colour their skin, what their crazy religious beliefs or cultural habits ... or where they happen to have been born. So, I insist, borders as they currently function are bad because they're discriminatory.