As I understand it, the plot twist Edgeworth undergoes was paramount to the telling of the game's story. The question the writers then asked themselves was "how do we get Edgeworth to do that". Their answer involved Tweedle Dee and Tweedle Dumb using logic that was admittedly flawed. As in, they're apparently conscious, in some way, about how stupid their line of reasoning is. But for sake of plot, they charge ahead. Edgeworth then takes their flawed reasoning to heart, as if it weren't flawed, as if it were the most solid act of reasoning ever. Again for sake of plot Edgeworth needed to do that.
The problem is, if everyone was in character and not being commanded by the god-writer, the plot twist might never have happened and it would've been a rather forgettable scene. As I understand, it's not that the plot twist occurred that's at fault, it's the handling of it that was moronic.