This seems to leave open the possibility of a non-Jewish messiah but I feel that is probably not accurate.
Also, is Jesus supposed to have been fathered by Joseph? I realize he isn't all that important a figure for Jews (and likely not a very positive one given the association with persecution) but it seems like there aren't many issues in the Jewish holy texts which haven't been thoroughly hashed out.
I do realize that Jews do not consider Christ the Messiah.
Jewish law with regard to lineage is a bit more complicated than being just matrilineal. Modern Jewish law (from sometime BCE to roughly 1800, and usually until the present) actually works patrilineally for most things. The most important thing for this today is the priesthood, which is passed father-to-son.
However, when a valid marriage in Jewish law cannot be formed between a couple, the father has no legal meaning, so parentage defaults to the mother. This means that in an intermarried couple, since a Jewish marriage can't happen between them, the mother's lineage is what's relevant (which leads to the general rule of "Judaism is passed matrilineally").
However, it's not entirely clear this rule was instituted--it seems in the biblical era the rule might've been always patrilineal, but exactly when this change occurred isn't entirely clear. So it's possible that for at least some of David's lineage maternity wouldn't matter much.