The problem is, it isn't the "parties" who run their best candidates, but the people voting in the primaries. The "parties" could have the smartest people in mind... but the choice ends up going to people outside of them.
The primary system, I think, is very problematic. The way it used to work--and did work for a long time until it started to shift midway through the 20th century--was that the state parties would send delegates to the national convention who would go and debate with each other and then vote for the presidential candidate, who needed to score an absolute majority. People would periodically vote, shift as they think it would be necessary, until they arrived at a consensus candidate. To win this sort of thing, a candidate had to convince people who were very invested in the future of the party that they were in fact the person who would (1) win and (2) well represent the party.
Primaries instead rely strongly on name recognition and having a lot of money to spend on all the advertising you need to do, and you have to do it over a long period of time because you nowadays have to announce your candidacy so far ahead of the election for it to work which means you need more money to continue to sustain your campaign. And instead of having to work to convince informed people with the party's best interests in mind, you're off to try to convince low information voters that it's critical that they go and spend a few minutes voting for you.
Unfortunately, it's hard to put the genie back in the bottle after making primaries so important. But it really has taken the nomination process, especially for presidential candidates, out of the hands of the parties, so it doesn't matter who the party leadership actually thinks is a good candidate, it's up to all the random voters instead.
Someone could of course counter with "Harris didn't win a primary and she wasn't a good candidate" and sure, but they didn't go through the old convention nomination process either (which would have been very difficult to do because they didn't plan for a contested convention, they assumed they had the winner already figured out). Forced into a corner thanks to Biden's bad decisions, they just had to find someone quickly to take up the role that the delegates could rally behind without too much fuss so they grabbed the person who was Vice President.
Given that the choice of candidate seems to essentially be out of the hands of the party itself at this point, the most they can really do is to try to figure out what the good strategies are after they have one.