You are correct that an appeal is not ordinarily in order if the defendant enters a plea, but doesn’t the judge have the responsibility to look at the basis for the plea and reject one that is not grounded in law. Since the judge, not the defendant, is charged with correctly applying the law, would Judicial error be grounds for setting aside a conviction. As to Mr. Davis, I was thinking of a civil action for inadequate representation.
I do think that an impartial judge would point out at several points further down the road that Cohen has pled guilty to something which is not a crime. I also wonder what happens at sentencing: "OK, you've admitted guilt to this, but it's not a crime, so I'm going to sentence you to nothing."
In order for inadequacy of representation to be on the table, Cohen has to prove that: 1) Davis did a terrible job (which he can probably do) but more importantly that 2) Davis' terrible job materially affected the outcome of the case. That second requirement is always going to be tough because you accepted the plea, which is evidence on its own face that you thought a trial outcome would be worse.
Nevertheless, the Supreme Court has been pretty clear that even in a plea deal you have a right to effective representation. So... maybe ...