Visitors to the US have been asked if they were members of the communist party since forever though?
IDK if those who replied "yes" would be sent back, but I do remember reading about Chinese communist party members being denied entry to the US.
I don't see much difference between this and that as far as the 1st amendment is concerned... aren't you idealizing the 1st amendment (and/or how seriously the US takes it)?
PS: let me make clear that I'm not trying to defend the indefensible behaviour of the Trump administration in any way