In discussing Mathew's version of the story, keep 2 facts in mind:
(1) The scholarly consensus is that Mark is a source used (90%) by Matthew. But Matthew also has his special source that scholars call M. In some cases there is a Mark/M overlap and our story is one such case.
(2) From its inception Mark is criticized for getting the sequence of events in Jesus' life wrong. Living eyewitnesses are able to correct that sequence. But Mark's Gospel is based on Peter's catechetical notes and reminiscences, which are designed for preaching and teaching purposes, not for an academically sequential biography. This makes it impossible to fit our story into precise chronological sequence of Jesus' ministry, though it seems to make a shift to an inclusion of Gentiles.
(1) The scholarly consensus is that Mark is a source used (90%) by Matthew. But Matthew also has his special source that scholars call M. In some cases there is a Mark/M overlap and our story is one such case.
(2) From its inception Mark is criticized for getting the sequence of events in Jesus' life wrong. Living eyewitnesses are able to correct that sequence. But Mark's Gospel is based on Peter's catechetical notes and reminiscences, which are designed for preaching and teaching purposes, not for an academically sequential biography. This makes it impossible to fit our story into precise chronological sequence of Jesus' ministry, though it seems to make a shift to an inclusion of Gentiles.