The vote for the candidate goes to their electors, who will actually vote for President in December. If they replace Biden before they vote, they will vote for the replacement. The Biden dies or withdraws after the electors vote, then Harris automatically takes his place per 20th Amendment.
I’m no expert, but I have a hard time believing that. What’s the point of the primary? On the election day, everybody just votes for random Democrats? And all of that just gets lumped together and Electors are chosen based on the Party? That may be right but it seems like it would be wrong.