The word "illegitimate" in that sentence refers to a ruling (by the President) -- not to the President himself. In other words, he's saying it's not unusual for a court to strike down an executive ruling, but no court, due to separation of powers, would declare a President illegitimate. That power is Constitutionally delegated to Congress, once the President is sworn in.
Okay .. strange that a ruling would be described
as illegitimate instead of unconstitutional; that
term is typically applied to the status of a person.