One of the great political gambles of recent times is playing out right now, in full view: Democrats are attempting to pass the most ambitious domestic agenda in recent memory with the smallest margin of congressional control in two decades.

The next few weeks will tell whether they succeed legislatively. We will find out in a year, during next year’s midterm elections, whether they succeed politically.

Democrats are gambling that success now, won by pushing through big changes from a narrow base of congressional power, will expand that base of support through sheer popularity of the programs once enacted. Legislative success, in other words, will breed political success.

That is far, far from assured. Many of the Democrats’ legislative dreams—new help for children and parents, expanded health benefits, aggressive efforts to combat climate change, new immigration rules—are all wrapped up in a $3.5 trillion “human infrastructure” bill that can pass only if Democrats stand united in support of it.

And right now, two Democratic Senators and a handful of moderate House Democrats are balking at the price tag. In a House where Democrats have just an eight-seat advantage, and a Senate evenly divided between the two parties, that could be enough to bring down the whole edifice. Legislative action after the Labor Day recess is going to be marked by brinkmanship between the Democrats’ progressive and moderate factions over how to get beyond that impasse.

House Speaker Nancy Pelosi has proven over the years that she is a magician at overcoming these kinds of divisions, and perhaps she will find the way to do so again. Still, the intraparty feuding threatens not just the $3.5 trillion measure, but also final passage of a separate, more traditional $1 trillion physical infrastructure package, which has bipartisan support and which President Biden considers one of the crowning achievements of his first year.

Democrats’ legislative agenda includes aggressive efforts to combat climate change; water levels in California’s Lake Oroville on Sunday.

Photo: josh edelson/Agence France-Presse/Getty Images

Meantime, Republicans are almost giddy right now over their political situation. They believe the $3.5 trillion plan represents a big political overreach by Democrats, representing a level of deficit spending that is scaring middle-of-the-road voters. Combine those fears with Mr. Biden’s slide in popularity in the wake of the ugly withdrawal of troops from Afghanistan, and a resurgence of doubts about whether the coronavirus really is under control, and Republicans are starting to think they are nearly guaranteed to take over control of Congress in next year’s midterm elections.

That expectation, in turn, gives Republicans little to no incentive to cooperate with Democrats between now and next November—including on an essential measure to raise or waive the federal debt ceiling that must pass in the next few weeks to keep the government from going into default. In short, Washington is going to see some very high-stakes political gamesmanship in coming weeks.

Things have reached this point in no small measure because the two parties have starkly different calculations about the country’s current mood. Republicans think Democrats’ ambitions amount to hubris—of the kind the GOP itself has been guilty of in the recent past—and there surely is a bit of that at work.

But Democrats also are operating from a belief that they suffer from structural disadvantages that leaves their strength in Congress short of their actual level of support across the nation. In this view, Republicans’ superior strength in state legislatures has allowed them to draw up congressional districts in state after state that give the GOP an unfair advantage in the House. And they believe Republicans’ strength in less-populous states, combined with Senate rules meant to protect the rights of minorities and rural states, means the GOP is using political process to thwart popular will there.

Democrats have a point, but probably not as strong as they contend. In the cumulative, nationwide vote in House races last year, Democrats enjoyed a three-percentage-point advantage, but won just a 2.3-percentage-point majority in the House. So their power in the House is below their national strength, but not by much.

Similarly, among the nation’s 10 least populous states, Senate seats are divided evenly between the two parties. Democrats have an advantage in the nation’s 10 most populous states, and they win well more votes nationwide in Senate races than their power there suggests, but the balance may not be as far out of whack as the rhetoric sometimes suggests.

The real gap is between the two parties’ view of the national mood. Most Democrats firmly believe that the continuing struggle to recover economically from the coronavirus, the lingering effects of decades of growing income inequality and fears of climate change driven steadily higher by extreme weather events all make the country ready for assertive government action across a wide front, a belief they think is supported by public polls testing their initiatives.

That is the real Democratic wager, and it is about to be put to the ultimate political test.

Write to Gerald F. Seib at jerry.seib@wsj.com