Upon the succession of William and Mary a clear line of succession was drawn up
1) Children from the marriage of William and Mary
2) Children from Queen Mary II by another husband (had she survived her husband who was older and often ill)
3) Princess Anne
4) Children of princess Anne
5) Children of William III by a later wife
So had William remarried as was planned for him by some courtiers and several members of his family and had that second marriage produced a child. The child would have been Queen Anne's heir.
Now had somewhere between 1696 and 1702 a son been born to William III and a second wife i could see a situation where that boy would have been made Prince of Wales and overstepped his aunt but that is another matter.
Mary II had two miscarriages early in her marriage had either of them resulted in a healthy child that child of either sex would have become the monarch after both it's parents had died.
When her sister Mary II of England died was Anne's reign guaranteed? The English parliament had stipulated that if William III/Mary Ii were childless, Anne, Mary's sister, would follow on the throne. After the death of Mary II, could her husband William III of Orange remarried, fathered children and placed the House of Orange on the throne of England?
We'll never know, but that would have been up to Parliament. The King's popularity declined after Mary's death in 1694, so who can say for sure what they might have done. It was only after the death of Anne's only living child (1700) that Parliament finally landed on a long-term succession plan. The Act of Settlement (1701) .was passed only months before William's death.