We can say "Thank you both for coming" or "How did you two meet?" but the other way around just seems wrong: "Thank you two for coming" or "How did you both meet?".
I'm having difficulty in explaining the difference between these two phrases.
The word both is not reflexive; it's used for two people doing something individually, and not mutually doing something to each other. So if you say they both fought, you're not saying that they fought with each other. On the other hand, if you say those two fought, it's reasonably likely that they fought with each other (although it's not certain).
Thus, you can't say how did both of you meet? or how did you both meet?
I don't think there's anything grammatically wrong with thank you two for coming, the way there is with how did both of you meet; it's merely unidiomatic.
In the context of your examples, both and two have different grammatical functions.
It could be argued that both is used as a pronoun, following the pattern in the examples below:
Both Used for emphasis to refer to two people or things, regarded and identified together. (as pronoun) ‘he looked at them both’ - Lexico
Both can be used ... as a pronoun: (following a pronoun object): I like them both. - macmillan dictionary
However, with "Thank you" being a single lexeme, it might be more useful to treat the word both here as a postpositive determiner that specifies the reference of the people being thanked. Although determiners are said to "come before the noun", postpositive determiners are not unheard of, as the following example shows:
... the English all in "The boys all ran fast" might be considered a postpositive determiner ... - Unity and Plurality: Logic, Philosophy, and Linguistics, ed. Carrara, Arapinis, Moltmann
Two, on the other hand, is used as a postpositive adjective, describing "you". It binds with "you" so tightly that we can (almost?) consider "you two" as a single lexical unit.
Looking at the lexical units clarifies the problem with swapping both and two in your examples.
In the "Thank you both ..." example, you is part of the "Thank you" lexeme. Substituting two for both makes you straddle two lexemes, which results in the awkwardness of the phrasing. We can resolve this by writing both lexemes in full, with a comma to split up the "you you" part. We then also need a second comma to maintain the original logic of the sentence, turning "you two" into a parenthetical:
Both forms preserve most of the meaning of the original (but "Thank you, two, for coming" is very different from "Thank you, both, for coming".)
As for "How did you two meet?", replacing two with both isn't ungrammatical. Although "How did you both meet?" could be met with "Who is this person you say we both met?", as Peter Shor hints at in his answer, the sentence imposes quite a strong context that the person each meets is each other.
You two [X] and both X both mean there are two X's. Neither say that A and B have anything to do with each other.
Both X means the A and B are in their own group or subgroup.
You two [X] means you are picking two out of a larger group, but the A and B aren't being treated/considered/acknowledged as a group together.
Since each was mentioned, I'll talk about it. Each X is like you two [X] but can be used if the number of X is unknown or greater than two.
Thank you both for coming
You might tend to say this if the two are husband and wife, or brother and sister, or two people who you believe know each other, for example.
Thank you two for coming
You might tend to say this if the two didn't know each other.
Thank you each for coming
It's much more idiomatic to say thank each of you for coming, and that means you're accounting for the possibility of any number of X. If you say this to two people there may be a faint implication there could or should be more than two.