For #26218 - Fixed various initialisation issues.

Found and fixed a few edge cases that would throw 'PythonObject is not attached to a node' errors in Nuke, resulting in the app not being loaded and the script being left in an error'd state.
- yep, that is clearer - will change
- It's using the nuke node to index on, not the name and it wouldn't matter if it changes anyway as it's just an optimisation to avoid calculating the path name too often.
- it's separate because the error may change but the dictionary is used in a compare to determine if the path needs re-computing