If the entail had started with Mary (blah blah I leave my property to my eldest daughter Mary and the eldest male of her body and the eldest male of his body in perpetuity blah blah) then her son would have inherited. But the entail does not include Mary so her eldest son will not inherit, unless, of course, she marries this doctor cousin and produces a son. This sort of thing often happened to keep an estate in a family. Landed families often married cousins to keep an estate in the family, hence the abundance of double-barrelled names or adoption of a surname allied to an estate.
It is almost easier to think of these estates as Big Business Conglomerates. Marriages were business arrangements. It was fortunate of the co-directors were actually in love with each other and tolerable if they liked each other. Often, they couldn't stand each other and looked elsewhere for love and sex, once the 'heir and a spare' had been achieved.
Until the Married Women's Property Act of 1882, married couples were seen as one person. Everything belonging to the woman, including her own body, belonged to her husband. Pre-nuptual agreemements are nothing new. Marriage Contracts specified in law what the woman would bring to the marriage and how it was to be used. Fathers often granted certain lanRAB or money to the wife for her life, which the husband couldn't touch. The married woman couldn't even write a will. Only a widow or an unmarried woman had any say in her own life. We have come a long way since then.