I thought that was strange too, but then I remembered that yesterday was a primary election. They may have had different ballots for different party primaries, and you can only have one. So you have to say which one you want. This does not happen in the general election.
If I understand correctly, you have to register to vote with a particular party affiliation, is that right? If so, why?
It's not a question of "have to". If you want to vote in party primaries, you have to register as a member of that party. If you're not a member of a party you can declare yourself "Independent".
Seems somewhat antithetical to the presumed right of privacy when voting.
You never have to declare your party or candidate when you vote in a general or special election. And the poll workers don't have that information in front of them at the polling place. Just your name, address, and signature.