Malcolm Turnbull would be forgiven for pulling his remaining hair out this week.

Tony Abbott is in open rebellion, parroting Bill Shorten’s attack lines. The feral chihuahuas at News Corp are yapping for blood. The obscurantist end of the neoliberal spectrum — the types who won’t ever accept that neoliberalism is now deeply toxic, because they’re paid not to accept it, like the editors of the Financial Review, and the corporate lobby group Institute of Public Affairs — are unhappy. Even Turnbull’s checklist of issues for the G20 summit — you need to pretend to have an agenda for what is a largely pointless talkfest — has been swamped by North Korea; you go to the trouble of briefing journalists on your agenda, they swallow your nonsense about encryption and write you up as tough on terrorism, and Kim Jong-un fires a missile that turns the whole event into a showdown about the Hermit Kingdom.

Barnaby Joyce is calling for sanctions against China (if you think that was an accident, who led the charge against restrictions on Chinese investment?) and Labor’s trying to take away Turnbull’s one-seat buffer in Parliament.

In truth, though, Turnbull is handling things about as well as could be expected. The refusal to say Abbott’s name during the week was silly. But his senior ministers are firing back at Abbott, pointing out he’s helping Shorten. They can’t control Abbott, as Turnbull loyalist Arthur Sinodinos noted. But they can return fire at this self-indulgent hypocrite whose thirst for revenge isn’t merely helping Labor, but disrupting the government’s capacity to govern effectively. Turnbull’s shift to the ideological centre gives him a fighting chance to restore his fortunes with the electorate, however much it looks as though they’ve stopped listening to him. And he’s proven he can secure the passage of legislation through the Animal Kingdom of the Senate.

[Abbott is Bill Shorten’s new best headkicker]

Turnbull would love to be John Howard — political master of all he surveyed for the middle period of his prime ministership, unchallenged within his own party and dominating Labor. Instead, he can only look forward to being Julia Gillard. Sounds like a rotten fate — but then Gillard defied the parliamentary odds, constant smearing by the media and relentless treachery from her predecessor, to achieve a strong program of legislation and an excellent economic record: substantial cuts to spending, landing a mining boom without an outbreak of inflation, and coping with the effects of a dollar well above parity. She made dud calls along the way, but concentrated on what she could control, from a position worse than Turnbull’s. Sure, Labor eventually succumbed to Rudd’s malignant egotism, but if Gillard could deliver for three years then Turnbull surely can.

As prime minister you only get to play the hand you’re dealt. Howard got lucky and presided over a revenue boom. Since then, prime ministers have had to cope with much more difficult economic challenges than working out ways to fritter away budget surpluses. Rudd had the global financial crisis. Gillard had a mining boom that threatened to tip the whole economy over. Abbott had very weak growth that needed fiscal stimulus. Turnbull faces a slow fiscal recovery, stagnant wages, a tentative economy and an electorate that is sick of, indeed angry about, free markets, looking after corporations and small government. His job is to make the least worst of a bad situation. It’s unglamorous stuff, but so far he’s managing.