The Trump administration's travel ban has certainly been the source of a fierce debate in and out of the courts. Whether or not the ban is good policy (I think it isn't), the question remains whether it is constitutional.
Let's put aside the issue of whether the ban, as written, contradicts the 1965 Immigration act or other immigration law passed by Congress, as this is a somewhat seperate issue. In fact, to focus on what I consider the crux of the issue, consider a government body X (either the congress of the president) issuing a blanket ban on all members of religion Y to travel to the US. Assume the ban does not apply to US citizens or green card holders.
What would be the legal argument for the unconstitutionality of such a ban? The ban, though unequivocally discriminating based on religion, would presumably effect non-US citizens who would not be covered by the first amendment.
One might argue the ban would still be unconstitutional because it would disproportionately restrict members of religion Y from using the immigration system to bring their families to the US, hence constituting a violation of the first amendment. If this is a reason for such a ban's unconstitutionality, would carefully designing the ban as to surgically allow members of Y to bring their families into the US affect its constitutionality?