This is vastly more pattern matching than term rewriting. In a term rewriting system you have no types for a start:
https://en.wikipedia.org/wiki/Rewritingis that important here? it looks like semantically types as presented are no more than magic constants to match on
Yes, in term rewriting systems the only thing that matters is the lexical structure of the "program" you're running on top of the transform rules. A simple example of running a TRS is a term of a BNF grammar, a less simple one is a symbolically expanding a term in a computer algebra system.
ok. sorry, so the issue is not that some of the runtime data is being interpreted as types, its that decisions are being made based on the data and not solely on the structure of the program.