A lot of debt also arises because of savings needs. If everyone is saving for retirement, for example, that savings has to be debt marked somewhere else. Examples:
* Social security used to have a huge surplus, that was savings that had to go somewhere (even if it was just a savings account in a bank, the bank would then be able to lend it out). They instead buy treasuries and that savings becomes debt to the USG.
* China likewise needs to save dollars because it doesn't want them sloshing around in their economy leading to inflation, so instead of using it to buy things they buy treasuries, and their savings becomes debt to the USG (not always a great deal for China if interest rates are below inflation).
The dollar has been so useful in the past as a currency of trade because you could save large amounts of it easily by buying US treasuries. One reason China doesn't want the RMB to be used so heavily for trade is that they don't want to do the same yet.