Contact ID Token for Sort Name
There's a place in the CiviCRM code where all the possible contact tokens are defined - and they say which fields they correspond to.

The line in question is:
'contact.contact_id' =&gt; CRM_Utils_Array::value('id', $fields),
which means, "populate the contact_id token from the id field passed to this function".

That's no doubt correct in some instances - but in this instance, the data is stored in contact_id.  I was able to get the contact_id to work in display_name and sort_name by changing this line to:

'contact.contact_id' =&gt; CRM_Utils_Array::value('id', $fields, CRM_Utils_Array::value('contact_id', $fields)),.  

This translates to, "populate the contact_id token from id if it exists, but contact_id if not".

Whether you want to shepherd this change into upstream CiviCRM or not is up to you!