What is the timing of building and paying debt?
According to the cities rulebook, p. 4:


  Important: Monetary losses are always resolved at the end of a turn, after players have played their cards, possibly having paid for trade and/or obtained money...


Therefore, for all your examples, you do have enough money to pay the debt. Monetary losses is the last effect to resolve itself, even following the "take a card from the discard pile" ability of Halikarnassós.