Do not use wysiwyg editor for system workflow message when workflow_name is set
A long time ago we "turned off WYSIWYG HTML editing of message templates when we introduced system workflow messages".
It looks like the code checks for the presence of a workflow_id to detect whether it is a workflow message.
More recently, we switched to using a workflow_name
in message templates but the code to switch between WYSIWYG and plain text does not look for a workflow_name which causes the templates which just have a name and no id to be rendered with the wysiwyg editor which mucks up the smarty tokens.
This isn't obvious in core as all entries in the civicrm_msg_template
table have a name and an id but if you add in a template with just a name and no id, you'll see what I mean.
PS. The UI I am talking about is at Admin > Message Templates > System workflow messages > Edit