Throughout most of the last several decades, Trump would have been unelectable, for just that reason. Traditionally, the electorate in the USA doesn't see the Presidency as an entry-level position, almost always whoever gets it has been either a governor, or a Senator or something, or often several things. But the anger and frustration has been building up to dangerous levels over the last 25 years.
That cycle I mentioned above has been cycling for a long time.
Back in their glory days, the Democratic Party had near-total dominance because of the legacy of Franklin Roosevelt, they dominated American politics from 1933 to 1972. Back in those days, the Dems were the 'party of the working man' and the GOP was the 'party of the rich', by which people meant 'the party of big business' whether they knew that or not. (Both parties were dominated by wealthy men, but the divide was real.) Also, in those days, the Dems were both the nationalist party and the socially conservative party, it was the GOP that was socially liberal and leaned internationalist (again, following the natural impulses of big business). Democrat Speakers of the House, in those days, would have called the Dem majorities after 2006 pallid and thin.
In the social upheavals of the late 60s, the emergent social liberal upper class disrupted FDR's majority, bringing back in the hard-core types that FDR had ejected with Wallace decades before. This led to the nomination of McGovern in 1972, which was a disaster for the Dems.
Richard Nixon won on a law-and-order platform, vs. George McGovern, who lost in an epic national landslide. But Watergate crippled Nixon's Presidency and let the radical Dems take control of Congress in 1974. They angered enough Dem voters to let Jimmy Carter come forward to win the Dem nomination in 1976, which started the downward spiral to where we are now. Carter ran as a morally traditionalist southern Dem, which played well in the after math of McGovern and Nixon. But once in, he governed as a McGovernite Dem, socially very liberal, anti-military, anti-Western, almost diametrically opposite what his supporters thought they had been voting for. To make it worse, he governed both oppositely and ineptly.
Reagan tapped into that and won two electoral landslides, the first with some help from the Anderson campaign that pulled from Carter in 1980, the second in 1984 with a genuine popular landslide as well. He did this with crossover Dem vote, the so-called working class 'Reagan Dems'. But they still preferred Dem economic policy, they just wanted the McGovern/Carter social policies and intellectual ideas off the table. The Dems refused to learn from experience for a while, in 1984 they nominated Walter Mondale, in 1988 Michael Dukakis. The latter was almost perfectly suited to alienate the conservative Dems they needed to win back. But even against Dukakis, GHWB lost a bunch of States Reagan easily held, a lot of Reagan Dems didn't trust him, nor did a lot of social conservative Republicans and others as well.
Clinton beat Bush I in 1992 by running the center, sort of like Carter in 1976. He refocused on economics, which is where Dems traditionally do best against the GOP, and Bush Sr. played into his hands with the unique House Bush brand of clueness disconnectedness. But even by 1992, there was so much electoral discontent that Perot was able to swing 20% of the popular vote.
Clinton's first 2 years were dominated by Hillary, though, she came very close to actually being President in 1993 and 1994, for reasons involving Clinton's sexual scandals and various internal deals. The Cabinet was packed with "friends of Hillary", Ruth Bader Ginsburg came from that camp, and Hillary infamously was assigned the role of health care mastermind. Clinton had run as a middle of the road conservative Dem, but once again, the first 2 years were dominated by McGovern style policy and social liberalism and anti-military thinking and internationalism, it was a lot like the Carter years.
Once again, the public rebelled, the GOP shocked everyone in 1994 by recapturing the Senate and House, the latter for the first time in over four decades. The trouble was that they immediately ignored what they had been elected to do (counter the liberalism of the Clinton Admin) in favor of trying to implement their preferred big business agenda. The GOP-dominated Congress focused on precisely the least popular elements of their coalition agenda, which collapsed their popularity.
Meanwhile Hillary had been sidelined by the 1994 election and Clinton went centrist, in time to beat Bob Dole in 1996, who let his wife run his campaign and more-or-less ran on 'fiscal conservative social liberal' again. The GOP always loses national elections when they run 'fiscal conservative social liberal'. But then came the Monica scandal and Clinton's momentum collapsed again.
This pattern has repeated over and over since 1972, and has intensified since 1994. The Dems win nationally, when they do, almost invariably on economics, but then govern social liberal and globalist. The GOP wins nationally, when the do, on social conservatism, American nationalism, tight borders, law and order, etc., but then when they win they govern on the business agenda (social liberal, free trade, open borders, globalism, etc.
In 2006, the GOP lost both houses of Congress because their own voters were disgusted with Bush's repeated attempts at immigration amnesty. The Dems immediately tried to help Bush do another try an immigration amnesty, which infuriated their voters further. The true roots of the TEA Party movement were in the networks that came together to oppose Bush, McCain, and Kennedy on immigration reform. The Dems were infuriating their own working-class white and black voters with amnesty proposals too, and a growing bipartisan opposition to the free trade regime was emerging as well.
But the GOP wasn't done with dumb yet. After 2006, the GOP apparat came together and more or less announced that there were 3 possible candidates for the White House in 2008, Rudy Giuliani, John McCain, and Mitt Romney. Right. Three different versions of 'business-wing conservative/social liberal', the toxic combination. Rudy was openly, proudly social liberal, John McCain was on the outs with the SoCon wing and was also Mr. Amnesty 2006 and Mr. Amnesty 2007, and Mitt Romney was Mitt Romney. Not a one of the 3 had a chance in November, even though the party geniuses thought it was an unbeatable slate.
Over and over, the voters switched one party out for the other, only to get the policies they most hated reinforced. Obamacare was so unpopular that it cost the Dems the House of Representatives in 2010, and would have cost them the Senate if the GOP had played a it a bit smarter. But the GOP, once back in, tried to switch from opposition to Obamacare, which the Chamber of Commerce likes, to 'entitlement reform', meaning cuts to or privatization of Social Security and Medicare, which the Chamber likes and their voters hate.
In 2010, the new Congress had not even been sworn in yet before Paul Ryan was talking about 'Medicare vouchers'. Short of deep-frying a live kitten on national TV, he couldn't have said or done anything much stupider, politically. That was just precisely what the GOP voters had not been voting for. Then in 2012, Mitt Romney seemed to think he was the protagonist of an Ayn Rand fantasy novel, banging on about Makers and Takers and entrepreneurs and 'unleashing Wall Street'. If there was one thing working class whites, black voters, Hispanics, Christians, Jews, and Muslims, and atheists, young and old, women and men, all pretty much agreed on it was that Wall Street was already far enough off the leash, thank you.
In 2014, the GOP were ready! They had the Gang of Eight Amnesty Bill!!! It was the best Amnesty and Open Borders Bill the voters could elect. The voters, OTOH, responded with, "What we have here is a failure to communicate." The bill passed the Senate and set to pass the House so Obama could sign it, when Eric Cantor, the GOP majority leader in the House, lost his primary to a political newcomer because his own voters were so angry about his immigration stance. It was the first time a majority leader had lost a primary vote in over a century, and it was Republicans who crushed the Republican incumbent.
Sorry to run on at such length, but if you were shocked that a novice outsider was entrusted with the Presidency, the nuclear codes, the whole enchilada, in spite of his known flaws, that's why. He addressed the issues the voters were upset about, and the voters had decades of experience that told them they would never get the results they wanted from the establishment. They knew that either Jeb Bush or Hillary Clinton would give them essentially identical policies, and they were sick of those policies. They had long since lost faith in the press, in the academy, in the courts, in the legal profession, in the political class, etc.
George Bush Sr. won the White House in 1988 on the strength that he would be Reagan's 3rd term. But he governed 'country club Republican'.