I take a somewhat different view.
There is absolutely no reason why political parties are permitted to involve the governments, states and federal, in the selection of their candidates.
Governments should only be involved in the actual election of candidates to public office. Political parties should choose their candidates by whatever means they see fit, including reading tea leaves. But they should not have access to nor restrictions from government mechanisms in doing so.
Bluntly, deny political parties government support, including voter registration (by party), and polling services.
This would then return the primary system to its original function of the party members determining the course of their parties. It would also make things much harder for media manipulation.
Will there be abuses under this method? Of course. That is not the concern of government. It is the concern of the party members. But most importantly it provides for political parties to grow & evolve, wither & die...all at the dictates of its members.
Sounds a lot like political free enterprise. Or just maybe it's how a healthy representative republic functions.
John / Billybob