Jesus' followers would have wanted to portray him as a great patriarch, part of the same lineage as Abraham, Isaac, and Jacob. While all Israelites claimed descent from Abraham, that alone would hardly be worth mentioning in the bible. It would have been taken for granted that Jesus were descended from Abraham in that sense. Biblical claims were meant to show direct descent as a patriarch, and community leader. Jesus followers would have also wanted to depict him as law giver, successor to the tradition of David, Solomon, and Josiah. The collapse of the northern kingdom was ancient history by the time Jesus lived, the ten tribes of Israel had already been lost. The messiah could only have come from the tribe of Judah, because they were all that remained. The tribe of Benjamen were very small, little more than Judean vassals. By Jesus times claiming the messiah could only come from the tribe of Judah would have been redundant.
During the early Imperial period, Jesus would merely have been one of many itinerant preachers to claiming to be messiah. To cement those claims, he and his followers would assert direct descent from the great patriarchs. While people of that time might not have taken this literally (some certainly would), a literal claim would best established the message that he was direct successor to the social, religious, and temporal authority of Abraham and David. The only valid way to claim inheritance would be from father to son, therefore claims to be descended from Abraham and David would have been literal, not merely figurative gestures, even if not entirely plausible to all the people of his time.
Jesus ancestry was traced through Joseph for the same reason we of European descent take our fathers family name. Roman society was strictly patriarchal, title and social status passed from father to son. Women could not even inherit property, let alone pass it to children. Greek society would have been the same. The thought of tracing Jesus matriarchal heritage would have been preposterous to citizens of the Roman Empire. If Jesus was descended from Abraham and David through Mary, it would have mattered little to the people of his time. As a descendant of the matriarchal line, Jesus could not have claimed to be their inheritor.