The Senate GOP's effort to overhaul the health-care system collapsed this week when multiple Republican senators came out against both the revamped bill and the idea of repealing Obamacare and letting the markets "fail" before replacing it. (Jenny Starrs/The Washington Post)

After seven years of promising to repeal Obamacare, Republicans expected that taking control of the two elected branches of government would make reaching that goal simple. With their latest stumble in doing so, we can draw two important lessons.

First, judging policy packages by their partisan wrappers rather than their actual parts can be a mistake. Second, the design of the Affordable Care Act of 2010 shares many similarities with its predecessors: the 1935 Social Security Act, the 1965 creation of Medicare and Medicaid, and the 2004 Medicare Part D prescription drug benefit expansion. All of these major pieces of social legislation at first faced skepticism or even opposition — and then became ingrained in American life.

Let’s examine these lessons here.

Judge legislation not by its party but by its parts

According to polls, more than half of Americans opposed the ACA. Then the 2016 election did what Barack Obama failed to do: increase public support for the ACA. With that election, public support for the ACA broke the 50 percent support barrier in the Kaiser Family Foundation tracking poll. Since then, the ACA has consistently had majority support among those who offer an opinion.

That’s because many of its key provisions are remarkably popular, and the prospect of losing them has revealed the ACA’s public support.

The ACA, like several of its predecessors, is built to last

It is only now clearer than it was before the election that most of the ACA has attained the status of an entitlement program — with provisions that significantly, though far from fully, work. And it is much harder to get rid of entitlements once they exist. In similar pieces of legislation, the general public has needed some time before appreciating the package. Skillful politicians long have understood this and have designed policies accordingly.

For instance, when President Franklin D. Roosevelt established Social Security in 1935, his goal was to ensure income security for retirees for years to come. To get there, he designed a way to give most Americans the feeling that it was theirs, broadly spreading both the taxes and the resulting benefits. As he explained:

“We put those payroll contributions there so as to give the contributors a legal, moral, and political right to collect their pensions … their unemployment benefits. With those taxes in there, no damn politician can ever scrap my Social Security program….”

Americans may have supported Social Security at first because they paid for it and felt entitled to it. But as more people began receiving benefits, they began to understand the more profound shift: Social Security lowered the distressing levels of poverty among the elderly. Some income security in retirement, however imperfect, came to be seen as a citizen’s right.

In 1965, Americans similarly embraced Medicare for seniors and Medicaid for the poor. This time President Lyndon B. Johnson did not have to resort to Medicare payroll taxes — although that would come later — to get support for the program. The benefits would be spread broadly across most Americans — and that alone was powerful enough to build political support over time. After his landslide victory in 1964, Johnson and his coalition overcame long-standing ideological opposition and public unease toward anything that could be dubbed “socialized medicine.”

With Obama gone, the public is seeing the provisions over the politics

Similarly, now that “Obamacare’s” not universally popular namesake is out of office, the ACA is being seen for its provisions — that is, for what it has accomplished — rather than simply through the lens of partisanship.

Large majorities like nearly all of the law’s major provisions, and now they prefer the ACA over any current alternative. The November 2016 Kaiser survey numbers on this were stunning. For instance, fully 90 percent of Democrats and 82 percent of Republicans supported allowing young adults to stay on their parents’ insurance until age 26; 89 percent of Democrats and 77 percent of Republicans approved the elimination of out-of-pocket expenses for many preventive services; 91 percent and 67 percent wanted subsidies for low- and middle-income Americans to purchase insurance; 90 percent of Democrats and 67 percent of Republicans support the Medicaid expansion; 75 percent and 63 percent wanted to prohibit insurance companies from denying coverage because of one’s medical history; and 82 percent of Democrats and 63 percent of Republicans support increasing the Medicare payroll tax on earnings for upper-income Americans.

This consensus had two important exceptions: Republicans and independents opposed both the individual mandate that everyone have health insurance, and also the business mandate that employers with 50 or more employees offer insurance.

President Trump and the Republicans apparently thought that the public’s opposition to these mandates was enough to do in Obamacare. They have found that they were wrong.

The repeal tide is going out

It may still take a while for the GOP leadership to look over its shoulder to see that most of the public is no longer siding with repeal. The July 2017 Kaiser poll numbers drive this home: Fully 71 percent of the public (91 percent of Democrats, 72 percent of independents, and even 41 percent of Republicans) want Republicans to work with Democrats to improve the ACA. Only 23 percent want to repeal and replace it.

This may not matter for the majority of Republicans in the House and the Senate who want it repealed or for those House members who worry about a primary challenge from their right. But apparently it matters to enough Republicans, including governors, who realize that they will have to confront these opinions in their next general elections and beyond.

Many of the ACA’s provisions have become part of the fabric of our health-care delivery and financing systems and have reshaped the preferences of the American public — now and for the longer term.

Robert Y. Shapiro is the Wallace Sayer professor of government and professor of international and public affairs at Columbia University and the co-author, with Lawrence R. Jacobs, of “Politicians Don’t Pander: Political Manipulation and the Loss of Democratic Responsiveness.”

Greg M. Shaw is a professor of political science at Illinois Wesleyan University and the author of “The Dysfunctional Politics of the Affordable Care Act.”