The only way the Obamacare replacement bill could have turned out worse is if Republicans had actually passed it. Thank the House Freedom Caucus.

Their failure to pass the Obamacare “repeal and replace” bill was a disaster for House Republicans. The only way the disaster could have been worse is if they had passed it.

This was a case of “you had one job” if ever there was one. Republicans have spent the past seven years obstructing Obamacare, complaining about it, campaigning against it, promising to repeal it, and repeatedly putting forward repeal votes. The American people rewarded them with two smashing midterm congressional victories that gave them control of both the House and the Senate. Now, with a Republican in the White House who would presumably sign whatever they put in front of him, there was no excuse for failing to deliver on that one big promise.

Yet somehow they have still managed to do it. You’ve got to admire ingenuity like that.

The causes were pretty obvious, and I already covered them prospectively. The first was tactical: making “repeal and replace” one package deal, instead of a straight repeal first, followed by a new set of health-care reforms. Instead of using the repeal to create pressure to pass the subsequent reforms, they made the repeal dependent on getting everyone to agree on a package of reforms—which was never going to happen.

The second error was more basic and philosophical: the whole idea of “replacing” Obamacare, which already stacked the decks toward Obamacare Lite. It committed them to something that would try to do more or less the same thing as Obamacare, instead of actual free-market reforms. As I explained, House Speaker Paul Ryan’s big claim to fame was his willingness to tackle entitlement reform, and that’s exactly how he approached this: Democrats pass the new entitlements, and Republicans reform them. It’s a long and depressing old story, filed under the heading, “Me Too.”

Yet there was still something new and hopeful to come out of this debacle. It was precisely the reason the Obamacare Lite replacement failed: the intransigence of the House Freedom Caucus.

Yes, that’s a good thing, because we know how a bill like this would have worked in the past. The Republican leadership would decide they need to nominally “repeal” Obamacare to appease the base, while actually keeping major parts of it to avoid being called mean and horrible (which they will be called anyway). So they cobble together an awful, botched compromise, then force it down everybody’s throat, and nobody is able to stand up and stop it.

They certainly tried to do it this time. President Trump just wanted a bill and didn’t care what was in it, responding to objections from the Freedom Caucus by telling them to “Forget about the little sh–,” which is a really great way of confirming to someone that you don’t care about the things he cares about. But they were expected to swallow what was served to them, with Steve Bannon thundering, “This is not a discussion. This is not a debate. You have no choice but to vote for this bill.”

Ah, but they did have a choice. The Federalist’s own Ben Domenech fills in the missing link, pointing out that this is the product of “a post-earmark legislative process.” Until he mentioned it, I had almost forgotten that part of the story. It’s easy to overlook, because it’s a matter of what is not there, the proverbial dog that didn’t bark.

What we have not seen is the old-fashioned arm-twisting that was routine under the system of congressional earmarks for spending. What we haven’t seen is a progression of lawmakers being either enticed with the promise of lavish new funds for projects in their districts, or threatened with the withdrawal of that spending.

When Republicans got rid of earmarks a decade ago, some of us pointed out that actual earmark spending was a tiny portion of the budget, about 1 percent of spending. The argument in return was that this 1 percent had a corrupting effect that multiplied its impact. For the sake of a few millions here or there in earmark spending, congressmen could be led into approving many billions more in giant new spending programs favored by their party leadership.

It looks like there was something to this argument. Eliminating earmarks meant that the members of the Freedom Caucus has less to gain and less to fear from the leadership. Or rather, it meant that they feared their constituents—whom they had promised to get rid of Obamacare—more than they feared Ryan or Trump. Way more than they feared Bannon. They were capable of so much independence that they actually formed a pact to resist outside pressure.

In a conference room in the Rayburn House Office Building, the group met that evening and made a secret pact. No member would commit his vote before consulting with the entire group—not even if Trump himself called to ask for an on-the-spot commitment. The idea, hatched by Freedom Caucus Vice Chairman Rep. Jim Jordan (R-Ohio), was to bind them together in negotiations and ensure the White House or House leaders could not peel them off one by one. Twenty-eight of the group’s roughly three dozen members took the plunge.

Notice how this turns the big narrative of the last election on its head. We were supposed to support Trump because he was the guy who was finally going to break the corrupt Republican “establishment.” Now he’s the guy launching tweet-storms on behalf of the establishment and against the House Freedom Caucus—the guys who actually did break the GOP establishment. And all because the Tea Party movement brought a few dozen hard line small-government advocates into office, and the ban on earmarks helped them guard their independence.

Twenty-eight lawmakers who care about freedom and are willing to stand up for it is not nearly enough. But Ryan and the rest of the Republican leadership now dare not make a step without bringing them on board. If they decide to be smart about it—and I’m not saying they will, but it’s always possibile—they’ll start over again with something that actually looks like a repeal of Obamacare.

So this is a pretty good start.

Follow Robert on Twitter.