Third party members and independents feel justified in participating in major party primaries because the majority of cost is paid for by the taxpayers. However, the 1st amendment to the Constitution guarantees the right of peaceful assembly which applies to political parties. California residents passed a top 2 referendum - fully open primaries with the top 2 winners advancing to the general election. That guarantees the general election winner will have a majority of the vote. The result is that general election voters get to pick from Democrat A or Democrat B. Last year Alaska voters passed a final 4 election process - same as top 2 except 4 advance to the general election. Enforced open primaries is a violation of the rights of political parties but the Supreme Court is normally hesitant to override a statewide referendum.
Without primaries there could be more than 50 candidates for POTUS and more than 10 for each U.S. Senator and each U.S. Representative. The typical voter would be overwhelmed and voting wait times would unacceptable.