As suggested in T159718 a column storing the full entity ID (i.e. its string form, not just a numeric part) should be added to wb_terms table.
https://gerrit.wikimedia.org/r/341322 is a draft of the patch adding column like the one considered here. That patch has been only introduced to illustrate the intent. While actually working on this it could either a separate patch (or patches), or that patch might be taken over and changed to the needed form. https://gerrit.wikimedia.org/r/341322 should not be considered something to follow.
Note that in T159718 DBAs suggested to introduce indexes including the new column at the point when the column is added. I.e. unlike @WMDE-leszek initially considered T159718, or it was proposed in the plan in T114903. This decision should be considered here.
Side note: It might be outside of scope of this task but when actually requesting the schema change, make sure to conform to https://wikitech.wikimedia.org/wiki/Schema_changes#Workflow_of_a_schema_change.