It is believed that very early on a community of Christians developed in Syria around the teachings of the disciple Thomas. At the same time, other communities were developing in the Empire around other disciples or apostles such as Paul, Peter, and John.
“Although [the disciple] Thomas never appears as more than a name on the disciple lists in the Synoptics, in [the Gospel of] John he is a significant figure.
…The character “Thomas” in John is a literary portrayal of the dominant figure in someone else’s community and is meant to convey a message to that community. The picture of Thomas in John, far from being the original source of the Thomas tradition, is an attempt to influence a Thomas Christianity already in existence. The earlier stage is the living Syrian Thomas tradition that John is at pains to counter.
…If chapter 20 [of the Gospel of John] is seen, as it should be, as the original ending of the Gospel, then the importance of the Doubting Thomas pericope to the author of John , coming as it does immediately before the conclusion, is quite apparent: the issue of Thomas is the last subject dealt with by the evangelist.” pp. 3-5
Gary: Riley believes that the author of John, who most definitely believes in the physical resurrection of Jesus (he is a proto-orthodox Christian), is using the Doubting Thomas pericope and two other pericopes in his Gospel which reflect negatively on the disciple Thomas (and which are no where to be found in the three Synoptic Gospels) to chastise the Thomas community of Christians in Syria for their denial of the physical Resurrection of Jesus!
And what better way to prove the physicality of the Resurrection than to invent a story which has the disciple who is venerated as the leader of the Christian sect which denies a physical resurrection sticking his finger into Jesus’ fleshy wounds!