As unsuitable as he is, as disastrous as a President Trump administration may prove to be, I doubt that the GOP could have done much to stop it.
Trump did a superb job of selling himself to the grass-roots voters and it was THEY (rather than the more politically-astute Republican hierarchy) that put him where he is now. I don't think there was a point where the party could have legally intervened.
What's alarming is that in appealing to the baser instincts of the voters he released a lot of ugly prejudices that most decent Americans probably abhor. A friend from Minnesota (all the Asklings would know her) said she deplores Trump and everything he stands for. She said that she's a lifelong Republican but asserts that "he doesn't speak for me. I'm not like that."
So now we have a situation where a totally unsuitable candidate may end up in the White House unless faithful Republicans switch their allegiances. Clinton is not an inspiring alternative but is clearly the better of two poor choices.