I don't know why Corbyn being heavily defeated was such a surprise to everyone, when he ran against Theresa May (who couldn't have campaigned any worse) he did terribly as well but it was lauded as some great success by the media and his supporters because he had done slightly better than Ed Milliband, who had resigned following his 2015 defeat.
Labour have the same problem the US Democrats do, they either have no policies, bat **** crazy policies or think that they can just get elected on a platform of constantly attacking the opposition with labels like Russian stooge, Dictator, Nazi, Racist, Sexist, Xenophobe etc. It doesn't work with adults which is why they want a lower voting age.