<<This should happen [judges should exercise extreme skepticism in the face of guilty pleas in capital cases], but it seems that if the accused is represented by a public defender, and/or is a member of a minority, this tends to not be observed.>>
Well, then you just need better judges.
<<When it is observed, a death sentence can take 25 years before it is finally given. >>
Even if the perp is 45 or 55 years old at the time, I'm sure it's still something he'd be extremely anxious to avoid. I don't like that punishment is delayed that much, but the alternative is the execution of a possibly innocent man, which is intolerable.
<<That means that it is not really a deterrent, as everyone has forgotten about the crime. >>
I was never much on deterrence. To me, capital punishment means a bastard getting what he deserves in return for the evil he's done and the elimination of the threat of more evil to come from him. If it deters even one onlooker from doing evil, so much the better, but I'd view that strictly as a bonus.
<<All the appeals mean that the process is extremely expensive as well.>>
There you've put your finger on one of the weak points of capital punishment. In order to eliminate the obscenity of 25-year waits for the executioner, you need to eliminate the haphazard, patch-it-up-as-you-go nature of the trial and appeal process for indigent prisoners, to ensure a first-class defence and appeal system where everything is done right the first time around. That means more money for lawyers, so each accused is defended by first-rate counsel and private investigators and experts at all stages of investigation, trial and appeal. Maybe it would cost too much. That's a judgment every decent society has to make. Justice is a commodity like anything else and if you're not willing to pay top dollar, you're not going to get the best available. Otherwise you're stuck with capital punishment and the full protection of the individual's right to life, but at a cost of long waits for full justice to be done.