The very countries that have huge trade surpluses against us have to buy USD denominated assets. Since they don't want to cause too much asset appreciation in this country they buy US treasuries.
Look at it this way - if I sell you $100 in goods and you sell me $100 in goods, nobody builds currency reserves.
However, if I effectively peg my currency to the USD (like China) and lower the price of my goods artificially, I encourage you to buy $150 of my goods while I block you from exporting a lot of goods to me, so I only buy $50 of your goods. Thus, I gain $100 of foreign currency reserves.
Now, I don't want to buy too many of your hard assets (like real estate) because that will also make you more wealthy. I don't want to buy too many of you stock either, same problem. I also don't want to dump my $100 into the world financial markets, selling USD, because that will lower the valuation of the USD, thereby making my goods less competitively priced, lowering my economy. So I just buy your treasury bonds and accumulate your debt, because I want my economy to keep growing.
The problem is that I can't buy them forever, eventually I'll have to diversify. Furthermore, I can't stop buying them, or my economy stops growing. So then I move on to buying other assets in USDs, such as real estate..etc.
China is trapped, everybody has bought into the 7%+ growth story and they need that high of growth to keep up with inflation. Their own people will revolt if they don't get that growth, so they *have* to keep buying. If I owe you $100 I have a problem, if I owe you $1TR, you have a problem. They have boostrapped their economy up through the currency peg.
The Fed has kind of rope-a-doped China through QE. Because China has to print Renmimbi to keep the USD/RMB peg at levels that promote exports, they have caused huge inflation internally and too fast of growth (massive credit expansion) and now the question is whether they can manage a soft landing or not.
Japan's problem is different. They have to keep their buying up because if their economy collapses they have no way of repaying their own debt, which is almost all held internally. Since their population is aging *and* shrinking, they are double fucked. They are even more than that though, they are triple fucked because they shut down their nukes. Now they have to import their power, which has caused them to be net-importers.