I work in a very male-dominated industry. I've encountered this type of thing a few times. I'm a rather friendly and easy-going person so I can usually just be honest and say what I need to in a nice enough way that I'm not offensive, but I am firm.
Those comments would have bothered me as well. And even when single, I did hope to one day get married and be a great wife. But I don't think that what I do at work has anything to do with being a spouse other than the fact that I'm honest.
The first time he said it, I would have been too stunned to reply. I would have replied with something like you responded.
Ideally, if he said something like that again I would have had a reply ready that would indicate that what he was saying was degrading or making assumptions.
If I thought he were sincerely a nice person who meant it as a compliment, I would have said "My job duties have nothing to do with being in the role of a spouse. Would you have made the same comment to others in the office like Bob or Jerry?" Hopefully, that would have made him think. But if he were especially dense, he might say "No, because Bob and Jerry won't make good wives." And I'd ask "Why not?" And he'd say "Because they're male." And I'd say "So, you're singling me out for being female?" And hopefully he'd catch himself there and apologize. If he still didn't, and said something like "But Bob and Jerry can't be wives" I'd say "but they might be husbands. Would you have told them they'd make good husbands someday?" Hopefully, he'd get it at that point. If not, then it would be time to say "In the future, please, don't speculate on my personal life. Thanks."
Even if I thought he was normally a jerk and was trying to speculate on my interest in getting married to someone someday, or trying to highlight the point that getting married is more important for a female than a career, I would still ask the same question "My job duties have nothing to do with being in the role of a spouse. Would you have made the same comment to others in the office like Bob or Jerry?" And no matter what he replied, I would quickly get to "I don't comment about your marital relationship. In the future, please, don't speculate on my personal life. Thanks."