I understand that there are a lot of different points of view on the H1B. However, when people talk about "protectionism" around tech jobs, I feel it is important to point out that tech jobs are already far more open to international competition than almost all "upper middle class" professions like law, medicine, or dentistry, and that much of the objection to these visas is around programs specifically designed to use the immigration to increase the size of the tech workforce, not immigration in general. This objection is, in fact, absolutely consistent with support for a more generally pro-immigration outlook and even the "greater good" you have mentioned. In fact, I'd say allowing general immigration where immigrants are not obligated to study tech-specific fields to get into the US, and are free to choose a profession rather than having to work in a set of pre-defined fields, is far
more pro-immigrant than restrictive tech visas.
Here's how many people who support immigration but are skeptical about the tech visas see the argument:
Claim: "there is a critical shortage of tech workers, therefore, we must change our immigration system to favor tech immigrants over other kinds of immigrants".
The response: "although immigration is generally beneficial, the evidence does not support claims of a specific tech worker shortage. Therefore, we should pursue a more general policy of immigration, and allow immigrants to respond to market signals when they choose a profession, just as free citizens and residents do".