You have to take into account his whole story. He was also going on and on at Gordon about having corrupt cops on his taskforce. In the end, it was those cops who he told Gordon to get rid of, Ramirez and Wertz, who were the ones who stitched Dent up and brought him to the Joker. He felt betrayed by Gordon, and he felt that all the good he tried to do was pointless.