That's democracy for ya, folks.
I think that the question which most needs answering is this: how the hell did the Labour party fail to capitalise in this election? The answer, I'm afraid, is (IMO) down to only two things: 1) the muddy and undeclarative Labour policy on Brexit; and 2) Jeremy Corbyn (who's also the chief architect of (1).
Labout has a shocking recent record of electing unelectables (by the whole national electorate, that is) as leader. Even though it's a truism that we vote for MPs and their parties and not for leaders/potential PMs, it's well understood in psephological circles that the choice of leader plays a significant role in the voting intentions of that small number of swing voters in key marginals who make all the difference in any election*. Ed Miliband was a disastrous choice - very few of those swing voters could envisage him as a global statesperson; and in many ways Corbyn was even worse for the same reasons. And what's more, the takeover at the top by the hard left faction resulted in the disillusionment, defection or retirement of many moderate left MPs. Coming back round to (1), Labour is just as split on Brexit that the Conservatives - in fact, very probably much more so. And there was no strong message on Brexit presented to the electorate.
I would be very highly confident that had a statesmanlike moderate such as, say, Chuka Umunna, been installed as Labour leader in 2017, Johnson very probably wouldn't even have tabled a GE for today: he'd have known pretty well that any GE would result in a fair-sized Labour majority.
(And always remember: the good fellows of the US elected the current Presidential incumbent....)
* i.e. there is a vast majority of the electorate who has always and will always vote for whichever political party they're aligned with. It's only ever the relatively tiny number of swing voters in marginal seats who make all the difference.