... Trump's mistake was in retroactively invalidating visas and green cards which had already been approved. If he had limited it to freezing new applications like Obama's "ban" did (to use what the media's terminology), then I think the judges would be deciding in his favor.
Actually, if he had just frozen new applications, I would have shrugged. So would most of the people who protested, IMO.
But we do have a principal of fairness in this country of not suddenly denying what had previously been granted.
"Hey, you can come work here! We have a job for you! H1b!"
Person sells stuff, quits current job, moves out of apartment, boards airplane
"Oh, no, we changed our minds. Psych! Go home!"
head|desk
Person comes here, has job, home, pets, etc. Lives and works here for years.
Gets green card, is no longer indentured to a company.
Goes to for a visit to family in former country. Tries to come back.
"Oh, no, your kind aren't allowed here. Go home"
"But my apartment and job are here in the US! I have a green card"
"Nope. Go away. You lose everything."
I have no love for the H1b visa program, it screws both US workers and the indentured foreigners who labor under it.
But I am not interested in screwing people already here out of everything they have worked for.