Question for this sort of situation: could you send an email to "confirm the case" to your boss and your boss'boss for this? They would need to respond and get this in writing. At that point, if they fire you they will have a big problem, if they don't hire the person, they will still have a big problem.
I understand that it creates a whole set of bad situations, so just asking what's the theoretical appropriate way to handle this
No. Don't do this unless you have a backup job, or can survive fine for a while on unemployment. If you do want to report the behavior, report the pertinent details to the EEOC (or whatever is equivalent for your country).
They could just not respond at all to the email. They could say the person receiving it didn't understand what the email was asking so deleted it. They could say that the managers never made any such statements and thought the employee (who they would also say had other performance or HR issues) was trying to entrap them, and that they fired the employee for the alleged entrapment.
Document and report. Don't try to catch someone unless you're advised to do so by a lawyer or law enforcement or the like.
I understand that it creates a whole set of bad situations, so just asking what's the theoretical appropriate way to handle this