### Godot version

4.1b

### System information

win11 Vulkan API 1.3.236

### Issue description

Selecting AnimationTree will result in error message 
`This function in this node can only be accessed from either the main thread or a thread group. Use call_deferred() instead.`

### Steps to reproduce

AnimationTree -> ROOT -> AnimationNodeStateMachine ->Add Animation.
There are several animations, clicking AnimationTree will result in several errors

### Minimal reproduction project

[test.zip](https://github.com/godotengine/godot/files/11708080/test.zip)

if (p_node == tree) {
		tree = nullptr;
		_clear_editors();
	}
}
void AnimationTreeEditor::_path_button_pressed(int p_path) {
	edited_path.clear();
	for (int i = 0; i <= p_path; i++) {
		edited_path.push_back(button_path[i]);
	}
}
void AnimationTreeEditor::_animation_list_changed() {
	AnimationNodeBlendTreeEditor *bte = AnimationNodeBlendTreeEditor::get_singleton();
	if (bte) {
		bte->update_graph();
	}
}
void AnimationTreeEditor::_update_path() {