Here is a way you can add unique IDs to task names by using Zapier:
If you don’t want to use the above approach, then sure, you could do this. You would use Webhooks or Events to capture all task changes in a project, check each changed task to see if (a) it has a value in the ID custom field and (b) that ID has not yet been added to the task name; when both of these are true, add the ID to the task name.