Do you mean that the author messed up, or that it was done with intent, that the author said these two (seemingly) conflicting things/ easliy disproven prophecy, with intent, or that the author expected (and wanted) the "this generation shall not pass" - passage, to be reinterpreted?
The question is, where is the "author"?
The Gospels are neither historical accounts nor purely fictional stories made out of thin air. The "author" uses pre-existent material (oral or written) and has to deal (more or less awkwardly) with its inconsistencies.
The "generation" saying apparently comes from Mark (or an early form of Mark). At first it was probably an anti-Jewish ex eventu "prophecy," meaning that the generation which (supposedly) rejected Jesus would be punished with the fall of Jerusalem. Matthew complicates the matter by linking it to the "end of the age" (v. 3, cf. v. 29, "immediately after") and inserting independent eschatological material (v. 26-28, 37-41, cf. Luke 17:22ff in a different context).
Matthew 10 also uses Markan and Q (equally Lukan) material but a large part of this passage, including v. 23, is found nowhere else. So the question is: does v. 23 actually belong to an earlier source (Q? there are very good reasons why Luke would have omitted it) limiting the preaching to Israel before the Son of Man (which is not necessarily Jesus) comes? Or does it reflect the same viewpoint as chapter 24, namely that the coming of the Son of Man should immediately follow the fall of Jerusalem? Still, in the latter case, the shift in the preaching scope (from "Israel only" to "all the nations," even though that may mean "to the diaspora Jews, as a witness to the Gentiles") remains a problem.
Of course 28:18-20 suppresses all the difficulties. As a side remark, the end of a book is the easiest place for anyone (including the so-called "author") to add something plain and simple, without resistance from previous material. Of course this does not suppress the difficulties in the body of the work.