When districts are competitive, both parties need to run candidates which appeal broadly to the electorate, because when ideologues/radicals win one of the party’s primaries, they end up losing in the general election.
When districts are not competitive (and especially when unlimited secret campaign donations are allowed), the primary campaigns end up driving candidates toward radical positions, because the primary is the only competitive stage of the process.
What we’ve seen with the GOP is a party that has moved sharply away from mainstream opinion, subjects all of its officeholders to strict purity tests, and is largely controlled by religious hard-liners and big donors (oil, defense, pharma, banks, telecoms, etc.), and has become increasingly anti-intellectual and overtly bigoted in the past few decades.