McCain lost because that was a bad year for the GOP, nobody was winning that year
Romney lost because it was Obama’s incumbent year, had he ran in this election, he very plausibly could have won the whole thing
Neither were outright disliked/hated as much as Trump currently is, a lot had to do with the situation they were placed in where almost anyone would have lost. If Trump loses, it’s in a year where the GOP has the advantage, as it’s following 8 years of Obama in an open seat election, and his approval ratings aren’t the greatest. I feel Kasich could win, Rubio could win, Romney could win, Paul Ryan could win, etc.
I’m not at all convinced that Trump could even plausibly win. Outside of his base 35-40% of the Republican vote, he doesn’t seem to have a real fan base. He’s even isolating social conservatives now. The fact that he’s against Hillary (a rather weak candidate in her own right for many reasons) is the only reason he has even a small chance right now.