One thing first, you might want to first try downgrading your node.js to v20 or 18, Odd number node versions are unstable releases
So I've recreated this and can see what you mean but this is over my head, I haven't much experience with $scope.$watch(...)
If anyone else (@hotNipi @Steve-Mcl, @shrickus) wants to look at this, this is a simple flow showing the situation.
[{"id":"1f817680e4e85993","type":"inject","z":"f044b74ff1eb4437","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230,"y":160,"wires":[["191f465392472653"]]},{"id":"191f465392472653","type":"ui_template","z":"f044b74ff1eb4437","group":"9a0edc351a6b6b2b","name":"","order":1,"width":0,"height":0,"format":"<script type=\"text/javascript\">\nvar $scope = this.scope;\n(function(scope) {\n $scope.$watch('msg', function(msg)\n {\n if (msg)\n console.log(`Incoming msg: payload=${msg.payload||\"None\"}`);\n // Process the msg\n });\n})(scope);\n</script>\n\n<div>\n{{msg.payload}}\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":440,"y":160,"wires":[[]]},{"id":"533877437c7b77fc","type":"inject","z":"f044b74ff1eb4437","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":240,"wires":[["4a200eca06b5435b"]]},{"id":"4a200eca06b5435b","type":"ui_text","z":"f044b74ff1eb4437","group":"e381245bb72a90b1","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":450,"y":240,"wires":[]},{"id":"9a0edc351a6b6b2b","type":"ui_group","name":"page1","tab":"99ad4f0b021bd16f","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"e381245bb72a90b1","type":"ui_group","name":"Group 1","tab":"3ef3649d7051f0f3","order":1,"disp":true,"width":6},{"id":"99ad4f0b021bd16f","type":"ui_tab","name":"With Watch","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"3ef3649d7051f0f3","type":"ui_tab","name":"No Watch","icon":"dashboard","order":3,"disabled":false,"hidden":false}]
Import the flow and then in your browser open the developer's tools/console. Press the inject attached to the ui-template
node. Then in the browser window looking at the dashboard select the 'No Watch' and then go back to the 'With Watch' page and you should see the incoming msg: count increasing.