Annulment does not make a child illegitimate.
Why not?
An annulment states the marriage never existed.
If a child’s parents were never married, the child is illegitimate.
Or do you have some other definition of “illegitimate”?