This, and ‘because that’s how we’ve always done it’ are probably the main reasons party affiliation is part of voter registration.
As to "why" the government should feel obligated to subsidize the process -- because the government has the ostensible goal of facilitating fair and proper elections, and presumably the primary process -- which is not Constitutionally-enshrined -- is a net benefit to the general election, at least compared to selection-by-party-convention. In the future, political parties may decide that it's better to have open primaries, but that's orthogonal to the government providing the voting infrastructure and logistics.
https://www.washingtonpost.com/news/monkey-cage/wp/2015/05/1...
Many include
1) Last time you voted
And
2) what your party affliction is