In Trump v. Hawaii, the Supreme Court majority concluded that 8 USC §1152(a)(1)(A), which you quoted, does not apply here, because the ban is on admission, not visa issuance. From page 22 of the decision:
The distinction between admissibility—to which §1152(a)(1)(A) does
not apply—and visa issuance—to which it does—is apparent from the text of the provision, which specifies only that
its protections apply to the “issuance” of “immigrant visa[s],” without mentioning admissibility or entry. Had
Congress instead intended in §1152(a)(1)(A) to constrain
the President’s power to determine who may enter the
country, it could easily have chosen language directed to
that end.
So the government may not discriminate when issuing immigrant visas. However, a visa does not guarantee entry to the US, and according to the majority, the government may discriminate in determining who actually gets to enter.
Moreover, much of the forbidden travel would have taken place on non-immigrant visas in any case (e.g. business, tourism, students, temporary work visas including H-1B), and the Court argued that this clause applies only to immigrant visas. You can see a list of immigrant and non-immigrant visa types here. Page 21 of the decision:
As an initial matter, this argument challenges only the
validity of the entry restrictions on immigrant travel.
Section 1152(a)(1)(A) is expressly limited to the issuance
of “immigrant visa[s]” while §1182(f ) allows the President to suspend entry of “immigrants or nonimmigrants.”
At a minimum, then, plaintiffs’ reading would not affect
any of the limitations on nonimmigrant travel in the
Proclamation.
The dissents don't mention this statute. However, they do seem to take the view that discrimination in admission simply violates the First Amendment.