If the medieval model doesn't work for your story, why use it? Invent your own society from scratch. So long as it is logical and consistent, readers will believe in it. Just at the moment, fantasy is moving away from medieval settings.
As a suggestion, you might want to do a fair bit of research into the history of Venice. That was a city-state that became very powerful at an early date, on the one hand because of its naval power, and on the other because it was able to control trade throughout the region. If you invented a society that relied on trade to the same extent, you might be able to work it out so that merchants could, indeed, rise to the nobility. Of course it would help if you plunked them down into a similar region, where land was limited and they were advantageously located for controlling the transport of merchandise.
Make the society sufficiently different from any specific real-world era and region, and you can handle the question of legitimacy in the way that seems best to you. (As you build your society, the answers to such questions might emerge in the process.)
It would be a very odd society indeed where legitimacy in one generation conferred it backwards to another.
As a suggestion, you might want to do a fair bit of research into the history of Venice. That was a city-state that became very powerful at an early date, on the one hand because of its naval power, and on the other because it was able to control trade throughout the region. If you invented a society that relied on trade to the same extent, you might be able to work it out so that merchants could, indeed, rise to the nobility. Of course it would help if you plunked them down into a similar region, where land was limited and they were advantageously located for controlling the transport of merchandise.
Make the society sufficiently different from any specific real-world era and region, and you can handle the question of legitimacy in the way that seems best to you. (As you build your society, the answers to such questions might emerge in the process.)
Here's a question. Her children would be legitimate, based on the fact that she's married to their father. Would they then have any claim to her father's estate? Or would it be a sort of one way legitimacy with the children only being able to inherit through their father's line.
It would be a very odd society indeed where legitimacy in one generation conferred it backwards to another.