L'esprit de l'escalier
I knew there had to be a term for this.
L’esprit d’escalier (literally, stairway wit) is a French term that describes the predicament of thinking of the right comeback too late.
I think we’ve all been there.
Aha! I’ve been trying to remember this phrase for God-knows-how-long.