By way of further answer:
Kamailio’s transformations exist in order to provide some semblance of string utility & parsing functions to a custom, from-ground-up programming language that wouldn’t otherwise possess them, for lack of a standard library that general-purpose programming languages have.
It has no built-in string primitives with accessor and mutator functions of various kinds[1], no String object with manipulation methods, no len(), no split(), etc.
The transformations are Kamailio config script’s effort to provide a subset of this sort of capability that is most useful for processing SIP messages.
Things like {tobody.user} exist in Kamailio because there’s literally* no other way to do that.
The whole point of doing Kamailio config scripting through KEMI in a more general language is to be able to leverage those general language capabilities, along with other libraries or modules, hot reload, etc.
— Alex
[1] Outside of the blunt instruments of textops* and friends.