Historically, they did just that. But historically, the two-party system translated to one-party rule in many places - most notably, post-Reconstruction South, where Democrats were the party. And their primary - ran by the party itself - was organized according to the principles of that party. So, for example, only whites could vote.
https://en.wikipedia.org/wiki/White_primaries
In the Civil Rights era, that arrangement was challenged on the grounds that the primaries become the de facto election, and when the party gets to run them as it sees fit, it's undemocratic. And so there was a gradual process of having primaries more regulated, and in particular, having them run by the state governments rather than the parties themselves.
As a result, today, we have things like "open primaries" (where anybody can vote without having to be a party member or declare affiliation), and even "top-two primaries", where the primary is basically the first round of the two-round general election, and not really a primary at all.
Ive always thought such efforts are another symptom of 'us vs. them", where the only goal is to get more of your members to vote. I think it would be aassive improvement if this information wasn't even part of voter registration. If you want to be a Democrat or Republican and vote in the primaries, that shouldn't be part of voter registration, you should have to separately register with your party of choice.
Because I just don't see any reason that anything you mentioned (targeted advertising, targeted transportation for the elderly) is at all a net positive for democracy.
Party affiliation is part of voter registration in the states that run primaries. Primaries are not part of the Constitution, and before the 1970s, party candidates were picked via convention, i.e. party elites. Making the primary vote accessible to all voters was ostensibly an attempt to democratize the selection process. Seems like it'd be logistically difficult to hold party votes without having a record of voter affiliation.
In many jurisdictions can't vote in a party's primary unless you belong to that party.
The US's political system is basically set up in a way that prevents more than two political parties feasibly existing. Some states have decided to ameliorate the two-party situation by tweaking the primary system to act as a pretend first round of the election instead of making the actual election be two rounds or other alternatives to first-past-the-post elections. Such a primary is known as a "jungle primary."
Personally, I've only lived in states that have open primaries (anyone can participate in the primary), or semi-open primaries (independents voters can participate in any primary; declared voters must participate only in their own party's). I'd personally prefer a blanket primary (you can choose the primary to vote in on a per-party basis), but the Supreme Court ruled that it unconstitutionally violated the freedom of association in the First Amendment.
One thing to remember about US elections: there's not one set of rules that governs everything. There's generally at least 50 different sets of rules, one for each state; and even then, you can get different rules for different races. Generalization is therefore quite difficult for US elections.