When cities go bankrupt ......

While the state may be required to do so as a practical matter, it does not appear that it is required to do so as a legal matter. Even though all power of a subdivision devolves from a state, the subdivision may still contract independently. See here, for example:

Or, here:

Huh? The federal government is the creation of the states. The states are not the creation of the federal government.

A state cannot obligate or encumber the government of the United States.