When she first became Prime Minister in 2016, Theresa May took an almost indecent glee in rolling back the era of David Cameron. His chancellor and closest ally, George Osborne, was sacked and the manner of his departure was briefed to the press. The Cameroon chumminess with the media was replaced by a layer of frost. Cameron’s strategy of delivering austerity to the young while channelling every possible benefit to the old was abandoned, as was the conscious attempt to reach out to affluent ethnic minorities and social liberals.

Then on 8 June, it emerged that May had rolled back another Cameron project: the first Conservative parliamentary majority in two decades, squandered with three years of the parliament left to run.

Abandoning the Cameron project – to make the party if not appealing, then at least not actively repellent to social liberals – now looks like a strategic error. She and her aides bought into the David Goodhart thesis: that politics was dividing between “somewheres” – that is, people with a strong sense of place and identity – and “anywheres” – global citizens who largely cluster in big cities.

But what she underestimated is that so-called anywheres are just as defensive of their place and their values. And they angrily defected from the Conservatives in decisive fashion across the country, but most strikingly in Canterbury, where Labour won a seat that the Conservatives have held continuously since the Great Reform Act of 1832. That also helped eradicate the party from Bristol and Cardiff, both cities the Conservatives entered the campaign hoping to turn blue.

In turning her fire on Britain’s over-65s through the “dementia tax” and restriction of winter fuel payments, Theresa May reduced the Conservative lead among the retired. That cost her party votes across the country, without gaining any support from the young. Turnout among voters over 65 dropped slightly on 2015, as grey voters, unwilling to back Labour but also unwilling to stick with the Conservatives, stayed at home.

Similarly, with just three words in her 2016 party conference speech – “citizens of nowhere” – May undid 11 years of good work among affluent ethnic minorities by David Cameron, who worked to reassure Britain’s ethnic middle classes that they were better served by voting with their economic interests, rather than against a Conservative Party still defined in the minds of many by Enoch Powell.

Her predecessor’s success in 2015 was not just devouring the Liberal Democrats, allowing the Conservatives to make a clean sweep of Cornwall and much of the south-west, but in eroding his party’s “ethnic penalty”.

Simply put, in 2015, rich brown Britons voted in much the same way as rich white ones. That shift helped the Conservatives win seats from Labour and turn a slew of marginals into what looked like fortresses. The result which summed up that quiet shift was that of Grant Shapps, the party’s then-chairman, who ended up with a majority of 12,153 in a seat that had been Labour-held until 2005.

For most ethnic minority voters, who tend to hold a second citizenship either spiritually or materially, May’s attacks on “citizens of the world” and her public embrace of Donald Trump contributed to a sense of unease. “It’s like the second affair,” one Conservative MP despaired to me; well-heeled minority voters who had trusted David Cameron when he said his party had changed were doubly angry when it reverted to type under May.

The result was the loss on 8 June of a number of seats where affluent ethnic minorities clustered in great numbers – in Battersea, in Bedford, in Croydon Central – and the collapse of super-majorities in others, such as Putney, Gloucester and Welwyn Hatfield, all of which are now within Labour’s grasp at the next election.

May amassed a larger overall share of the vote – 42 per cent – than Cameron. But most in her party privately argue that, thanks to the collapse of Ukip and the continuing woes of the Liberal Democrats, this was an election in which the big two parties had a larger prize to fight over – and Jeremy Corbyn, not May, did the better job of thriving in the new environment.

That argument is bolstered by analysis by David Cowling, the BBC’s former head of research, which shows that May got a smaller share of the two-party total, at 51 per cent, than Cameron did in 2015, with 55 per cent.

And yet, she endures, after a fashion. The settlement between the Conservatives and the Democratic Unionist Party means that while May is certainly not strong, she is stable. Her government can last the full five years, should her party wish. Although no one expects that lengthy a spell in Downing Street, May’s political lifespan now looks likely to run longer than was thought.

The perception of May within the Tory ranks has, ironically, come full circle. At first, Conservative MPs supported her not out of any great affection – she has never cultivated a phalanx of loyalists as George Osborne did – but because the other candidates had either been blown up or had blown themselves up. Grudging admiration turned into respect when their constituents seemed to fall in love with her. But as her maladroit campaign and her tone-deaf response to the Grenfell Tower tragedy turned voters against May, MPs, too, reverted to their original assessment.

Only dissatisfaction with the possible replacements keeps her in place. Conservative MPs look at the available field of talent at the top of the cabinet table and find them all wanting – either through lack of talent, or, in the case of Amber Rudd, a majority so small as to make her leadership an ongoing psychodrama about her own survival. Small wonder that the two candidates most frequently talked up – Philip Hammond and David Davis – are largely spoken of as interim solutions, better placed to promote new faces in a bid to revive the party.

For that reason, May has cause to thank her predecessor. David Cameron’s reluctance to reshuffle his Cabinet means that the top of the Conservative Party looks much like it did when he first became leader. And it is the lack of a fresh alternative to Theresa May that means Conservative MPs adhere to her, not out of affection, but for want of anything better.