Only a few months ago Bill Shorten would have thought that if he won the election he’d be delivering same-sex marriage and a royal commission into the banks early in his government.

Now Malcolm Turnbull is bringing us both – in each case, his hand forced by a (different) group of rebel backbenchers.

The marriage bill, which will go through the House of Representatives next week, has some disgruntled conservatives arcing up after the Senate rejected their amendments, but Turnbull will mark it down as one of the achievements of his prime ministership.

It’s another matter with the banking royal commission. Seldom is a government’s impotence and frustration as much on display as it was when Turnbull finally capitulated and announced on Thursday that the government would establish the inquiry it has so long resisted and denounced.

For quite a time political hardheads had been arguing the government should accept the inevitable and “own” an inquiry. Well, now it does – and what a reluctant owner it is, miserable and bitter.

Turnbull and Treasurer Scott Morrison lamented that setting up the royal commission, which covers superannuation and insurance providers as well as banking, was “regrettable but necessary”, driven by the political circumstances in which they found themselves.

In the end, there wasn’t a choice.

The bad result for the Liberal National Party in Saturday’s Queensland election strengthened the hand and determination of the rebel federal Nationals, intent on pushing Barry O'Sullivan’s private senator’s bill for parliament to set up a commission of inquiry.

Two lower house Nationals, George Christensen and Llew O'Brien, were willing to cross the floor to give the bill the numbers there. In the background Nationals leader Barnaby Joyce, on the New England campaign trail, was not resisting the flow. Joyce judged that if the issue reached the Nationals’ partyroom, the commission would get support.

The Nationals also knew an inquiry had strong public backing, a point underlined by an Essential poll this week showing 64% wanted a royal commission. That included 62% of Coalition voters.

The banks themselves came to accept that opposition had become too costly. In their Thursday letter to the government (flagged late Wednesday) advocating “a properly constituted inquiry”, the chairmen and chief executives of the four major banks said it was “in the national interest for the political uncertainty to end.

"It is hurting confidence in our financial services system, including in offshore markets, and has diminished trust and respect for our sector and people,” they wrote.

As Australian Bankers’ Association chief executive Anna Bligh, a former Queensland Labor premier, put it bluntly, it was too a big a risk to have a inquiry where the terms of reference and choice of commissioner were in “the hands of minor parties and fringe elements of the parliament”.

On Tuesday and Wednesday, O'Sullivan, Turnbull and senior ministers sparred over the issue. O'Sullivan, a tough ex-cop from Queensland, says the government didn’t try to get him to drop his bill. Rather, it was attempting to “manage time”. He knew it was working on something, though he didn’t know what.

The ministers wanted to find out when his bill would be ready for the Senate. Some say O'Sullivan put it on pause. He denies this, saying his negotiations with the Greens and others and the preparation and printing processes pushed it back to early Thursday, which helped the government.

Cabinet met first thing that morning – Turnbull’s announcement was at a 9am news conference. The bill had done its job without having to make an actual appearance in parliament.

The government’s perennial arguments – until Thursday – against a royal commission have included that it would undermine international investor confidence in Australia’s banks and that an inevitably prolonged inquiry would have delayed the reforms the government has introduced or proposed.

The first proposition will be tested now that the inquiry is to proceed. It is doubtful, however, that overseas investors are as easily frightened as the government has been suggesting. They’re surely sophisticated enough to understand the fundamentals of our banking system, and those are sound.

The government has maintained its measures are adequate to address the issues but O'Sullivan and other proponents of an inquiry insisted they would not deal with the dimension of “culture”. The banks’ “profit before people” attitude, as Nationals senator John Williams puts it.

A circuit-breaker is needed to restore public confidence in banks. But the material to emerge during the inquiry may lower that confidence further before there is any sign of its restoration.

The royal commission will be led by a former or serving judicial figure and will be asked to deliver a final report by February 1, 2019, with an interim report before that. The terms of reference will be tight: “it’s not going to be an inquiry into capitalism”, Turnbull said.

The Nationals’ brutal power play may deepen tensions between Liberals and the junior Coalition partner. Not that the Nationals care that much.

Christensen didn’t hesitate to rub salt into Turnbull’s open wound. “I just don’t understand why it took a number of National Party backbenchers to drag the prime minister kicking and screaming to this decision,” he said, in a cutting but pertinent observation.

O'Sullivan was more diplomatic, speaking of Turnbull “making his own journey”. A journey, it might be said, under armed escort.

Meanwhile, the Nationals were relishing shades of the 1937 royal commission into the banking system. As a Senate report of a few years ago recounted: “At the 1935 election the Country Party (and the Labor Party) had promised an inquiry and when the conservative government led by Joseph Lyons was forced to form a coalition with the Country Party, he agreed to establish an inquiry”.

If it had responded much earlier to the pressure for an inquiry the government could have hoped to reap credit for appreciating the depth of public complaints and concerns.

As it is, with its grudging decision through gritted teeth, it doesn’t seem to be looking for plaudits.

But the political reality is that by establishing the royal commission it has neutralised one of Shorten’s issues.

For all that, it could be a Shorten government that deals with the commission’s ultimate recommendations. By the time the final report rolls round, an election will be imminent, assuming the royal commission runs on time and the government runs full term.