Earlier quoted context omitted.
It's not hearsay to go to the witness stand and say the defendant told you something. That defendant is there in court and is able to defend themselves.
Correction: it is in fact hearsay but it is admissible under one of numerous exceptions to the rule that hearsay is not admissible. Laws are generally clearer if you write them as general definitions and general rules and if those cover too much carve out exceptions in the rules rather than the definitions. It would work to make the exceptions to the definitions instead, or to both the definitions and rules, but that…
Similar motivation as exceptions for error handling