As lawmakers appear ready to make a deal to end the federal government shutdown and debt ceiling showdown scant hours before the midnight deadline for the United States to extend its ability to pay its debts, one is left to wonder, how did it come to this and what do we do from here?

If from the beginning it was going to end in an agreement that neither side loves, why did lawmakers have to wait until the full faith and credit of the U.S. was perilously called into question around the world to reach it?

Did we really need to wait for intransigence in Washington to reveal itself yet again as a crippling fact of life, allowing an opening for the world to scorn our self-defined exceptionalism?

“It is perhaps a good time for the befuddled world to start considering building a de-Americanized world,” the Chinese government news agency Xinhua declared over the weekend, according to the Telegraph.

It’s a situation that polls show most Americans don’t want to be in, and it’s one that leaders in Washington need to address in order to ensure that they never find themselves there again.

This isn’t even the first time it’s happened under House Speaker John Boehner’s watch, as you’ll remember that in 2011 Congress similarly waited until the last minute before raising the debt ceiling. Despite the fact that economic crisis was averted by a last-minute deal, the close call still resulted in the Standard & Poor’s credit agency cutting America’s debt rating from AAA to AA+.

And Newsweek reports that S&P and its fellow credit agency Fitch were ready to cut it again on Wednesday until news of a potential real agreement broke that afternoon, proving that the fire Boehner and his unruly charges were playing with was yet again red-hot.

There are some simple knee-jerk answers to why America came so close to driving the financial markets into turmoil and perhaps even restarting a full-blown global recession on the level of the 2008 crisis. Boehner is incompetent, one theory goes. He was unable to admit defeat until it became clear the GOP had lost this round. A maverick Republican caucus was unwilling to budge. President Barack Obama wouldn’t give in to demands that a significant minority of the country supports, goes the other side’s argument, illegitimate as it may be. Democrats were the ones who were being unreasonable.

But none of these theories get us anywhere in the long run, and somehow addressing all of them would do little to prevent a similar display of high-stakes political theater from gripping the world again in however many months Congress agrees to extend the debt ceiling for.

The real cause of this debacle, and the reason there is nothing to suggest the world will avoid a mind-numbing case of debt ceiling déjà vu in the very near term, is rooted in the law (or lack thereof) of the land, and the very Constitution that guides it.

Many observers have argued that the 14th Amendment to America’s founding document does in fact provide Obama with a workaround that would allow him to wield his executive powers to ensure that raising the debt ceiling is never a concern again during his term.

But the White House denies that Obama has the lawful power to unilaterally raise the ceiling as these observers say he can under the “Public Debt Clause” of Section 4 of the amendment, which states that the “validity of the public debt of the United States, authorized by law, ... shall not be questioned.”

In other words, according to the White House, it’s not up to the president to ensure that the debt ceiling is periodically raised, and as the courts clearly have no authority to do such a thing, it’s on the Congress to make certain that it gets done each and every time the roof needs to be raised without threatening the nation’s economic health.

In light of recent history showing that in the current legal environment lawmakers can and will hold the federal government and world economy hostage, it has become abundantly clear that the more responsible members of Congress need to come together to find a permanent legislative fix to what is becoming a perennial crisis. It’s the existence of a legal way for a small contingent of Congress to forestall a government function as essential as raising the debt ceiling that has led America to this low point in its history.

The details of just what kind of law would be necessary for debt ceiling showdowns to go the way of the gun duel are not clear. But it is abundantly so that such a law is vital to the future economic health of America and indeed the world.