The Catholic church has no concept of illegitimacy. That’s a secular legal term.
If the father is unknown, or “unknown,” the baptism certificate says “pater ignominiam,” father’s name unknown, if I have the Latin right—this is where our word “ignominious” comes from.
Post 1983, you are correct that "illegitimacy" does not have any meaning in canon law.
An annulment only says that the marriage was not the Sacrament of Matrimony. The marriage is NOT illegitimate.