Yes, unfortunately, references are not immediately present, due to how they are implemented.
I know it’s a workaround, but you could create a formula field which counts the number of references to the Task, and use a change in this value to trigger the script.
See below…