All because Dent was supposedly soooooo great and so good despite ever really being that great or good.
The whole "hero with a face" and "symbol of hope" crap was a plot device for Bruce/Batman. That's all it was. Bruce sitting at the table getting all starry-eyed because this guy is talking about Caesar, Rome, and heroes becoming villains was ridiculous. Batman shouldn't be so quick to hand the city over to a guy he just meant.
I agree that Dent wasn't all that good - he clearly had a bad side to him even before Two Face, that is both hinted and shown as you say.
But that's not the point - he was the 'hero with a face' because he came up with a way to keep the streets clean without even a shot fired. He did what Batman couldn't do. But more than that, he gave the average person a role model to look up to and be inspired by.
In TDK, Bruce/Batman is shown to be providing the wrong sort of inspiration to Gotham - instead of inspiring people to believe in the 'system' and due course of law, he's inspiring vigilantes taking the law into their own hands. This is shown to us pretty clearly.
Bruce doesn't want to inspire Gotham in that way - so he figures he needs someone conventional - someone who doesn't have to hide behind a mask. Dent fits the bill, he's not perfect - and Bruce knows this because he witnesses the incident with the Joker thug posing an a honor gaurd - but if he can continue to do a good job as DA, he may just work.
So when we come to the end, and it's all gone to hell with Dent not only dead, but turning out to have completely lost it following Rachel's death, Batman thinks that Gotham would really lose all hope if they find out what actually happened. So he takes the fall for it to try and create this false martyr - the hero gotham needs for that moment, in order to counter the fact that the Joker actually won and proved his point with Dent.
That's where TDKR picks up from what we know - this sacrifice of Batman's work's for a period of time, but since it was all based on a lie, it's a fragile situation, and things are not as good as they seem on the surface.
Following this logic, I think at the end of TDKR Batman will finally become the hero that gotham needs, the one that they deserve. Whether his fate will parallel Dent's ie he too will be martyred, but this time a true martyr, not a made up one - I don't know.