The idea that the beloved disciple (John, in our view) represents believing humanity and that Mary is a figure of the Church is a theological interpretation firmly grounded in tradition, but not a literal historical reading of the text. In other words: it is a symbolic understanding arising from a spiritual exegesis, not an explicit statement of the Gospel itself.
More precisely:
The text of John 19.26-27 describes a concrete fact — Jesus entrusts his mother to his disciple; but the Gospel of John, highly symbolic by nature, often uses real events to convey a broader spiritual meaning.
Since the Church Fathers, particularly Irenaeus, Augustine, Ambrose or Bernard of Clairvaux, this scene has been interpreted as the moment when the community of believers is formed. Mary is seen there as the spiritual mother of the disciples, and the “anonymous” disciple as the figure of the faithful believer.
This reading also rests on the Johannine theology of the “new people of God” born from the cross, comparable to the birth of Eve taken from Adam’s side (Genesis 2.21-23, 1 Corinthians 15.45). When the soldier pierces Jesus’ side and “blood and water” come out (John 19.34), the evangelist sees in this sign the source of the new life given to humanity. Thus Mary, standing at the foot of the cross (John 19.25), represents humanity receiving life in Christ; in this sense, she bears witness to the birth of the “new Adam” and of the redeemed people issuing from his sacrifice.
So, yes: it is a traditional symbolic interpretation, perfectly legitimate and theologically grounded in the Christian reading of the text, but it goes beyond the purely narrative meaning to reveal an ecclesial and mystical dimension intended by many commentators.