If the candidates that are put up in the general aren't what people want, why did they win the primary?
However the issue is that the party members are a small proportion of the general public.
Thus a small group is enough to win the vote in the party, This tends in a two party system to make the winner more extreme and less likely to be liked by the general public.
See Liz Truss as a good example here (as well as Trump)
https://ballotpedia.org/Superdelegates_and_the_2020_Democrat...