The key point here is that foreign capital comes in search of a high rate of return on investment. America's technology economy, backed by disinflation, deregulation and low capital tax-rates, has consistently produced the best investment returns in the world. That is why foreign capital comes here. Foreigners are investing wisely. No one holds a gun to their heads.
Foreign capital arrives voluntarily.
Even our Army, Navy and Air Force couldn't keep this foreign capital away. But repeated liquidity injections from foreign capital inflows have made our economy even stronger, allowing investment to rise even more. Radically raise interest rates, or tax rates, or tariff rates, or impose Nixonian wage and price controls. This will produce a recession, or worse. So no one will import.