> Curious, why? Countries vary in size, so this seems like an arbitrary restriction.
It is not an arbitrary restriction at all, it is the only possible way to have balanced trade in a hostile environment. You have the balance of trade identity:
change in current_account + change in capital_account = 0
That means in order for nation A to be a net importer of goods, it must sell off its capital to the foreign sector.
So instead of thinking "Lazy Americans love cheap foreign goods, so they import too much and that makes them poorer so they have to sell off their capital to "borrow" from abroad"
Think like this: Nation B prints up money, uses it to buy bonds/factories/etc in nation A, which forces the currencies to adjust so that Nation A's products are more expensive to nation B and Nation B's products are cheaper to Nation A so that enough is imported to balance the current and capital account, and in this way Nation B's intervention makes Nation A poorer.
Then the question becomes, why should Nation A allow this type of intervention?
Indeed, the impoverishment of Ireland was due mostly to British landlords who owned a huge portion of Irish land, and British firms that owned a huge portion of Irish industry, making the Irish mere renters of their own country's capital.
> Also: how is it undesirable to have a foreign company build a factory that hires workers?
You do not need foreigners to do that. For a foreigner to build a factory in nation A, they have to first export some good to nation A, and instead of using the proceeds to importing an equivalent amount of goods, they use the proceeds to buy some land or a factory, etc. That land or factory could have been bought by someone in nation A if they would not have been deprived of the export income.
In other words, in a floating currency regime, it is impossible for the foreign sector to "bring money in" to another country and fund investment - trade is not funded with specie flows - it is only possible for the foreign sector to drain income from nation A's current account, and then re-invest the income that was drained via the capital account. Thus all foreign investments are merely efforts to recycle trade surpluses, and they are required for the trade surpluses to occur in the first place.
That is what is wrong with foreign capital inflows, and why all nations from South Korea to China that follow export-led growth plans always heavily restrict or outright ban foreign capital inflows, much to the consternation of economists who think foreign capital inflows help rather than hurt. Asia knows that these inflows hurt, and it's time we realized that, too.