To whom does the title New Eve refer? To Mary, or to the Church? And is one of these usages in a meaningful way older than the other?
I'm not aware of any study that seeks whether one of these analogies historically depends more on or derives from the other than conversely (e.g., whether the title of Church as New Eve derives to a significant extent from the understanding of Mary as New Eve, or whether conversely, the title of Mary as New Eve derives to a significant extent from the understanding of the Church as New Eve)–though see the citation from the New Catholic Encyclopedia below. In any case, both of these analogies (Mary as New Eve and the Church as New Eve) seem to be proximately and firmly rooted in the Scriptures, and are theologically almost inseparable. That Mary, Mother and Type of the Church, has the role of the New Eve, is intimately bound up with the nature of the Church as the New Eve.
Both analogies are clearly found in the Fathers:
Mary as New Eve
Just as Eve … being disobedient, became a cause of death for herself and the whole human race: so Mary … being obedient, became a cause of salvation for herself and the whole human race (St. Irenaeus, Against Heresies, III, xxii, 4).
Christ became man by the Virgin that the disobedience which issued from the serpent might be destroyed in the same way it originated. Eve was still an undefiled virgin when she conceived the word of the serpent and brought forth disobedience and death. But the Virgin received faith and joy, at the announcement of the angel Gabriel…and she replied, "Be it done to me according you your word". So through the mediation of the Virgin he came into the world, through whom God would crush the serpent (St. Justin Martyr, Apologia, ch. 100).
Church as New Eve
As Adam was a figure of Christ, Adam’s sleep shadowed out the death of Christ… that from the wound inflicted on His side might, in like manner (as Eve was formed), be typified the church, the true mother of the living. (Tertullian, Treatise on the Soul, ch. 43).
The apostle directly referred to Christ the words which had been spoken of Adam. For thus will it be most certainly agreed that the Church is formed out of His bones and flesh; and it was for this cause that the Word, leaving His Father in heaven, came down to be “joined to His wife;” and slept in the trance of His passion, and willingly suffered death for her, that He might present the Church to Himself glorious and blameless, having cleansed her by the laver, for the receiving of the spiritual and blessed seed, which is sown by Him who with whispers implants it in the depths of the mind; and is conceived and formed by the Church, as by a woman. so as to give birth and nourishment to virtue….
[When Paul] was grown to a man, and was built up, then being molded to spiritual perfection, he was made the help-meet and bride of the Word; and receiving and conceiving the seeds of life, he who was before a child, becomes a church and a mother, himself laboring in birth of those who, through him, believed in the Lord, until Christ was formed and born in them also. For he says, “My little children, of whom I travail in birth again until Christ be formed in you; “ and again, “In Christ Jesus I have begotten you through the Gospel.”
It is evident, then, that the statement respecting Eve and Adam is to be referred to the Church and Christ. (St. Methodius, The Banquet of the Ten Virgins, Discourse 3, Ch. 8-9.)
Adam sleeps that Eve may be formed; Christ dies that the Church may be
formed. Eve is formed from the side of the sleeping Adam; the side of the dead
Christ is pierced by the lance, so that the Sacraments may flow out, of which the
Church is formed. Is there anyone to whom it is not obvious that future events
are represented by the things done then, since the Apostle says that Adam himself
was the figure of Him that was to come? (St. Augustine, In Ioannis evangelium tractatus 9, 10; translated by W. A. Jurgens, The Faith of the Early Fathers, vol. 3 (Collegeville, MN: Liturgical Press, 1979), 117.
From the article on Mariology in the New Catholic Encyclopedia:
Mary’s spiritual motherhood of the members of the Mystical Body appears clearly only in the 12th century, e.g., in Hermann of Tournai. A factor here is the mutual enrichment of Mariology and the theology about the Church. The maternal meaning that has always been part of the concept of the Church as new Eve is applied now also to Our Lady as new Eve. ‘‘Like the Church of which she is the figure, Mary is mother of all those who are born again to life’’ (Guerric of Igny, d. 1155; Patrologia Latina, 185:188).
… The National Conference of Catholic Bishops (NCCB) in the pastoral on the Blessed Virgin Mary points out: ‘‘Even more anciently, the Church was regarded as the ‘New Eve.’ The Church is the bride of Christ, formed from his side in the sleep of death on the cross, as the first Eve was formed by God from the side of the sleeping Adam’’ (NCCB 41). ("Mariology", edited by E. R. Carroll and F. M. Jelly, New Catholic Encyclopedia).