Of course it was. But as a matter of fact, the research on the Holy Graal, the history of the French monarchy and the Merovingian dynasty can induce people to doubt the fact that Jesus was a chaste man.
How?
Besides, there is a Gospel of Magdalene too.
1) Nowhere in the Gospel of Mary is Jesus described as a lover of Mary, and the language used to describe the way Jesus "loved" Mary more than the other disciples is likely imitating John's "the disciple whom Jesus loved".
2) It is entirely possible that the Mary described not only isn't Mary Magdalene, but not even a single character: Shoemaker, S. J. (2001). Rethinking the" Gnostic Mary": Mary of Nazareth and Mary of Magdala in Early Christian Tradition.
Journal of Early Christian Studies, 9(4), 555-595.
Certainly, the Mary is never identified other than by that name and is not differentiated from other Mary's that Jesus knew or that became part of the Christian tradition.
3) There is also an "gospel" supposedly written by Thomas about Jesus' youth that dates from the 2nd century and describes him as Dennis the Menace with superpowers. It's equally historical (i.e., it contains no historical information about Jesus but does tell us about the development of Christianity, just like the Gospel of Mary).
4) The so-called "gnostic gospels" generally use Mary (if they include her) as a character to undermine Peter and by extension more mainstream early Christian views. The earliest "gnostic" gospel, Thomas, ends with Peter saying "let Mary leave us for women are not worthy of life", to which Jesus responds "I shall guide her in order to make her male, so that she too can be a male like you/For every who makes herself male will enter the kingdom of heaven." What does this mean?
"Here it is surprising to note that the basis of access to spiritual life is not, for example, an act of grace or atonement available to everyone, nor is the reason for Christs reprimanding Peter that Christ has forbidden or overturned the rejection of women from the spiritual world. Rather, Mary is to be accepted into a circle of the spiritually authoritative and granted access to salvation because Christ intends to make Mary male so that she is thereby qualified for life. Maleness, which resembles the state of being a living spirit in this text, is the grounds for inclusion and is so firmly established as such that even this Apocryphal Christ manages to include Mary as a legitimate and worthy member of a religious group only by overriding her sex.6 Hence Mary is not included or accepted as a woman, but is transformed and re-categorized as a man, and then accepted."
Stefaniw, B. (2010). Becoming Men, Staying Women: Gender Ambivalence in Christian Apocryphal Texts and Contexts.
Feminist Theology, 18(3), 341-355.
Not exactly a ringing endorsement for thinking that the "gnostics" considered Mary to be Jesus' spouse or lover (and that's without getting into the extent to which the category "gnostic" can be meaningfully applied to the diverse and disputed texts it is).