For the hundredth time on this forum, an annulment doesn't make the children illegitimate. Right. There was no marriage, but the children are legitimate. (?)
What sort of bizarre legal fiction leads to that result?
A civil one. Property has to go somewhere when someone dies. I think if there is no will and the deceased has property that goes to the next of kin, if that is the child, the legitimate child gets it before the illegitimate. If there is a will the guy can give to his mistress and leave his children out if he wants. If can give it to the Ku Klux Klan. Otherwise it goes to the next of kin--spouse, then children, ones by marriage before ones outside of civil marriage. I don't think the male has place over the female in inheritance but I think blood still has some place in the question. One can use the argument that such and such is not the deceased's legitimate child and would have a pretty good argument unless the bastard can show some proof the will of the deceased, even implied, or suggested, was otherwise. May be cruel, but laws have to have such boundaries to work. Within the Church I do not think it matters except that the child was born out of wedlock. But that's the parents sin, not the child's.