Family objects Also have a UID (Templates.UID)
Suggestion:
Give that "text" an instance variable: ToDelete (number)
Below set Text action, add:
set value ToDelete = Templates.UID
add a condition to that delete:
Famlity Templates >> pick by UID (Text.ToDelete)
Action Templates destroy
This will leave your object name mechanic intact and add functionality to delete the template based on it's unique ID.