BEcause Wilhelmine wasn't the first choice for Josef as a bride. Louis XIV was offering his niece, Liselotte d'Orléans, and his mother and uncle wanted him to marry a Palatine cousin (in spite of Eleonore having been the one to stuff Wilhelmine in a convent for her education as Josef's wife). Plus, the Welfs were on the rise, having just been promoted to elector blah-blah-blah. So if he marries earlier, he's not necessarily marrying Wilhelmine (although I doubt he'd be marrying Liselotte (both his parents were against this)).
As to the lack of children post-1701, I've read speculation that Maria Amalie's birth either rendered Wilhelmine incapable of bearing further children, or the doctors advised against further pregnancies. The oft-cited refrain of Josef's syphilis is a non-starter since he only passed that on to her around '04 (which seems strange if the doctors had advised against further pregnancies). Plus there's the fact that Leopold I also instituted a Family Compact before he died indicating how the succession should run in the event of Josef not having a son, which seems unlikely he would've drawn up if Wilhelmine had been able to have more children (and courts were porous environments, one of the doctors examining Wilhelmine would've reported to the emperor, but the chambermaids to the footmen were generally regarded as part of the furniture, but could still carry gossip, and something as salacious as the Queen of Hungary being unable to bear further children would've definitely gotten out). Of course, Karl VI overturned this with his own Pragmatic Sanction, and the rest is history