If you are known to directly or indirectly provide assets to a government and said assets are a critical part of the infrastructure, you're responsible for the safety of the government in your dealings.
An American company refusing to recruit people from China is just the US government refusing to hire the Chinese government to run the country, not companies discriminating against individuals. This holds true even if you swap the states in the previous sentence.
For the record, I'm not a citizen of either of the aforementioned countries but my home country has a similar relation with its neighbor.