NT scholar Craig Evans thinks that John's Gospel belongs to the genre of wisdom literature. It depicts Jesus as wisdom personified. Hence, Jesus didn't actually express the "I am" sayings attributed to him in that Gospel. That would make the same mistake as taking the narrative in Prov 8 literally.
This revisits issues regarding the historicity of John, so I'll venture a few observations:
i) The idea that John contains a wisdom Christology is not unusual in Johannine scholarship. Ben Witherington is a prominent example. I myself think that's forcing John's Gospel into a paradigm with precious little supporting evidence. And Evans seems to be taking that approach to a logical extreme. Of course, we could say that discredits the whole approach.
ii) In fairness, Evans also notes that John is loaded with historical details.
iii) A common question is why John has a more explicitly high Christology than the Synoptics. Liberals say that's because it's unmoored from reality. It represents a more developed Christology. An evolving Christology–at the expense of the historical Jesus.
I'd propose a different explanation. Because the Synoptics have a more Jewish milieu, a Jewish reader would pick up on the high Christology of the Synoptic Jesus. In the Synoptics, Jesus is presented against the backdrop of OT monotheism. The Synoptics are chockfull of clues to Christ's identity, given the parallels between Jesus and Yahweh. Given how Jesus says and does things that would be blasphemous if he was merely human.
In fact, we might turn this around. If, say, Matthew was as explicit as John, he'd never get a hearing from Jewish readers.
Because John arguably has a more gentile audience in mind, he must accentuate the more explicit statements of Jesus, or make more explicit statements about Jesus inasmuch as Gentile readers aren't tuned into the Jewish code language.
I'd hasten to add that this is a matter of emphasis. John is a Jewish writer, and his Gospel reflects a Jewish outlook. But it is, in a way, a Jewish missionary to Gentiles. He was probably ministering in Asia Minor at the time.
It might be objected that we'd expect the same explanation to apply to Luke. But Luke amplifies Mark. Because Luke operates within the narrative contours of Mark, that constrains his ambit, whereas John strikes out on his own with an independent plot line.
iv) The lengthy speeches in John, such as the farewell discourse and prayer (Jn 13:31-17:26) seem artificial. Is that how people normally talk?
But there's a reason it's called the "farewell" discourse. Jesus is wrapping things up. It has a testamentary character to it.
In addition, although it's one-sided, this is not an uninterrupted monologue, but interspersed with questions that, in turn, give rise to answers.
Finally, this wasn't just for a handful of people in the Upper Room, but with an eye to posterity. Jesus is like a broadcaster whose statements aren't merely directed to a studio audience, but primarily to the unseen audience behind the camera. He's speaking for the benefit of Christian readers, when the record of this discourse is published.
v) A problem with treating the "I am" sayings as fictional is that these are tightly woven into the setting. For instance, "I am the resurrection and the life" is entirely appropriate as a prelude to raising Lazarus from the dead. Why wouldn't Jesus say that on this occasion? By the same token, "I am the light of the world" piggybacks on Hanukkah, on the one hand, and healing the blind man, on the other hand.
Likewise, "I am the bread of life" and "Before Abraham was, I am" are responsive to the immediate context. Embedded in rambling, sometimes acrimonious exchanges with his enemies. They have the meandering quality of real conversations. The give and take of real conservations. Indeed, the cut and thrust of live, impromptu, public debate with hostile opponents.
Furthermore, we'd expect an extraordinary person to make extraordinary claims about himself. It's only unrealistic if you presume Jesus wasn't God Incarnate.
"I am the way, the truth, and the life" is responsive to Philip's question. Moreover, it makes sense in the context of a farewell discourse. And it combines a number of scattered motifs in the Fourth Gospel.
"I am the gate," "I am the good shepherd," and "I am the true vine" occur in parables. Surely Jesus taught in parables.