I understand that they can just print money and if push comes to shove they can just do that to pay a debt. Lots of countries have done it and it’s ended terribly every time.
Except they can't (in other words, you still don't understand it!). Governments don't have control over the printing of money (despite owning the printers themselves). This is for the obvious reason that a government alone cannot be trusted with the management of money supply.
Money itself is not wealth, but a very liquid representation of it. A government cannot pay off its debts with its own currency by printing more of it (as this fundamentally makes no sense and you already know it). Every time the Fed injects more cash, the nominal debt of the US government increases. The debt would always be higher than the amount of cash injected to pay it off and therefore you can never do so, nor has it ever been done that way in history.
Please read more of my link and, I don't know, read a book about monetary policy maybe? Understanding the basics of how modern financial systems work should really be required education but somehow it always falls through the gaps. Probably because a great many people benefit by ensuring you understand as little about the financial system as possible.