Make input pin's tooltip respond to undo/redo when the value is set within the pin

When the pin value is set externally (say from an IO Box) and changed using undo/redo, the value shown in the tooltip changes accordingly:

But if the value is set within the pin itself and I do undo/redo, the value shown in the tooltip doesn’t update: