### 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)

for (int i = 0; i < editors.size(); i++) {
		if (editors[i]->can_edit(p_node)) {
			return true;
		}
	}
	return false;
}
Vector<String> AnimationTreeEditor::get_animation_list() {
	if (!singleton->is_visible()) {
		return Vector<String>();
	}
	AnimationTree *tree = singleton->tree;
	if (!tree || !tree->has_node(tree->get_animation_player())) {
		return Vector<String>();
	}
	AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(tree->get_node(tree->get_animation_player()));
	if (!ap) {
		return Vector<String>();
	}
	List<StringName> anims;
	ap->get_animation_list(&anims);
	Vector<String> ret;
	for (const StringName &E : anims) {
		ret.push_back(E);
	}
	return ret;
}
AnimationTreeEditor::AnimationTreeEditor() {