The 7 countries in question are nearly 100% GroupM majority countries with a small % of GroupC people.
Some of GroupM wishes to work and play in the US.
Some US based companies and citizens want some of GroupM to travel to the US for those purposes and for other reasons. A visa is required.
Some of those US companies claim that they will be harmed if some of GroupM are unable to travel to the US, or the travel is delayed.

GroupC is persecuted based primarily on their religion in 7Countries. Some of GroupC also wishes to travel to the US to flee the persecution.

A limited number of visas to come to the US are granted to 7Countries.

The US Federal Executive Branch wishes to prioritize the evacuation of GroupC via an EO.

A US Federal Judge has ruled against granting priority for visas to GroupC because (1) a religious test, (2) would cause irreparable harm, (3) is a GroupM ban based on their religion

Note: At the time of major terror incidents in the name of the religion of GroupM, in parts of the world including the US, a private citizen proposed an immigration halt from GroupM majority countries until the US could “figure out what the hell is going on”. Coincidentally, that US citizen was later elected to POTUS and issued the EO.