The spelling rule (see chapter 21 of the Guide) states that if the CH is preceded by a short stressed vowel, it uses the TCH. (catch, ditch, Dutch). If the sound is preceded by a consonant or a long vowel, it must use the CH. (branch, each, lunch). It is a simple rule. Easy to learn and easy to understand and there are barely a dozen exceptions. For example, rich, much and detach.
The big question is why do we have this rule? Whether or not the word contains a T seems to make no difference to the sound of the word. The T does not make the preceding vowel short or long. Compare filch and fitch, wrench and wretch, or crunch and crutch. That T doesn’t seem to do anything to the vowel sound.
Would it make any difference if ketchup were spelled kechup? Or if kitchen were spelled kichen? Would it matter if butcher were spelled bucher? Not really.
Perhaps the rule appeared at a time when words that use the CH in various unusual ways were slipping into the English language. Words like chef, chute, chorus, choir, chaos, machine, school, stomach, echo, lichen.
When and why this spelling rule appeared I do not know. What is much more interesting is the way the rule is fully accepted by scholars and students alike. There is general agreement that it is a logical rule and there are very few exceptions yet, when we look at it carefully, we see that there is no good reason for it to exist.