Even aside from the issue of whether or not kingship could be passed on matrilineally (it couldn't), it appears that Mary was a Levite, not from the tribe of Judah.In the days of Herod, king of Judea, there was a priest named Zechari'ah, of the division of Abi'jah; and he had a wife of the daughters of Aaron, and her name was Elizabeth. (Luke 1:5)Since Mary and Elizabeth were cousins (or "sisters" ;o), presumably Mary would also be from the line of Aaron.
In the post-captivity region of Judea (where several tribes lived intermixed), one of Mary's time could have multiple tribal ancestries.
The Levites did not intermix. If they had, they would have been ineligible to serve as priests.
And he shall take a wife in her virginity.
A widow, or one divorced, or a woman who has been defiled, or a harlot, these he shall not marry; but he shall take to wife a virgin of his own people,
that he may not profane his children among his people; for I am the LORD who sanctify him." (Leviticus 21:13-15)