Yes, Mary Bennet is pedantic, boring, tedious, thinks far too much of her own paltry accomplishments. But consider this: She is the middle child. Jane and Elizabeth are close companions, as are Kitty and Lydia. Mary is kind of stuck by herself. I think she may pursue books and music in an attempt to get a share of her father's attention, since her mother clearly favors Jane and Lydia. She is emulating Lizzie but lacks Lizzie's intelligence or common sense.
Also, she's considered the only plain one in the family,so she may have decided she needs to be more accomplished in order to snare a husband. I also wonder if Mary is preparing herself to be a governess in case her father dies and leaves the family in need. But I will not pursue this topic any further at this point in the story!