I think you can have both.
How
could you do that yesterday?
(astonishment/surprise at the person for really having done a perhaps awful thing)
How
could you have done that yesterday? It was clear you didn't have the time for it.
(A rhetorical question. The action/thing was
not done, because
the person didn't have time to do it. Thus how can one, that person or
a third party, pretend that it was feasible?)