I have no faith about sayings of Jesus floating by in the oral tradition and then being captured by a gospel author (which by the way is an apologist's argument in order to explain the gospel authors were not creating sayings). For example, "Mark" created "Hosanna", "Matthew" added on "Hosanna to the Son of David".I agree with your sub-title, a sub-set of G.Matthew was used in creating the passages in the Didache. That sub-set was a series of sayings of Jesus that existed before the Gospels did.
About "Hosanna", he following would indicate the Didachee was working from the subset of gMatthew:
Ch.10 "Hosanna to the God of David
["Hosanna to the Son of David" (Mt21:9&21)]"
"Son of David" is a favorite title in gMatthew (Mk = 3, (Q = 0), Mt = 10, Lk = 4, Jn = 0). "Matthew" had Jesus called David's Son by (only in gMatthew) blind men (9:27), a crowd (12:23), a Gentile Canaanite woman (15:22) and children in Jerusalem temple (21:15). So it is very predictable he would have Jesus also acclaimed as "Son of David" by the crowd during the all important "triumphal entry" (21:9).
Therefore, the expression "Hosanna to the ... of David" originated most likely from gMatthew (with "Matthew" getting the very odd word 'hosanna' (Hebrew for "save") from Mk 11:9). And with the wording extracted from gMatthew, "Son" was substituted by "God" in the Didache. It looks the author did not like Jesus being called "the Son of David": that would be most understandable from an Ebionite's viewpoint!
I note "Hosanna to the Son of David" is not a saying of Jesus in gMatthew but part of the narration. It is also typically Matthean. However "Hosanna to the god of David" (in a prayer) is very strange and seems to be a modification.
Cordially, Bernard