I've thought about this problem creating a system to save game state. The issue with assigning a UUID works until you have dynamic scenes added to the game at runtime. The nodes in those scenes will all have the same UUID. In the end I ended up just using the paths and saving the fact that the scene that data is being saved for is dynamic. Then the system sees this and re-instances the scene and adds it back to the tree. (A slight adjustment to the path must be made as Godot will create nodes with the at (@) symbol in them, but you can't do that yourself.)
You can see this in action at my demo repo on github.
Godot 4 2D Visibility Mask Demo
If you ever wanted to make a game using visibility masking like the classic horror survival game Darkwood, then this demo is for you! In the readme I go over how it works as well as some pitfalls I've found along the way.
If you have any issues or feedback for the demo, please let me know. Thanks!