Dan Brown only considers the entire record, not just the orthodox tradition that became authoritative in the New Testament because of the intervention of the Roman emperor Constantine - who was baptized only on his deathbed, and used and co-opted the church to politically consolidate his control over the empire - to the point of demanding that Nicene council fathers resolve the divinity of Jesus question.  That was in 325 A.D. - fully three centuries after the Christ with none of the first witnesses still hanging around.

No matter how much you try to suppress the gnostic traditions in Christianity, no one can deny their presence even in the New Testament.  The "beloved disciple" was most certainly more likely to be Mary Magdalene, but that tradition has been obviously wrenched out of the text with silly ideas about the relationship of Jesus and the evangelist John.