She was a bad mother at first because of her adultery with David.However she was a good mother to Solomon whom the ORD favored.
Remember that while the Davidic Dynasty did end after Zedekiah because of sin, the curse...
but Jehoiachin was later treated kindly in Babylon.
I also thought of Mary's role being Jesus' mother was to also later fulfill this prophecy.
Psalm 69:8 declares the sad prophecy that Jesus would be a stranger unto his mother's children.
Galatians the Apostle Paul mentions James as the Lord's brother, the brother of Jesus who was a son of Mary and Joseph.
Everything was really planned and perhaps, one may understand the doctrine of predestination for some people through Mary aside from Jeremiah, Moses and David.
But by Bathsheba, David had other sons and Nathan was one of them (1 Chronicles 3:5).
So Mary was a descendant of David and for Jesus to be the Seed of David and Seed of the Woman, Mary was the perfect candidate.
Any faithful woman who was a descendant of David would have gladly offered any sin offering like Mary did knowing they are sinners in need of salvation.
A closer study of the Holy Scriptures will tell us a lot of reasons why Mary was chosen to be Jesus' earthly mother.