I mentioned the relationship between capital flow and surplus before. Let's take the trade relationship between Russia and India as an example:

1/ Russia has a surplus with India. It sells oil but has nothing to buy

2/ So Russia has accumulated a lot of Indian rupees. Indian rupees are nothing more than a number recorded in the account books of Indian banks. So it is equivalent to Russia's investment in India. This is similar to China's investment in US Treasury bonds.

So sometimes it is the surplus that leads to capital flow - when your country has nothing for others to buy.

But for countries like China and the United States, which have a full range of product categories, both sides have enough products for each other to buy, which means that the capital flow determines the surplus. At the very least, American agricultural products and energy are all priced globally. There is no such thing as you holding US dollars and having nothing to buy.