### Godot version

v4.1.rc2.official [46424488e]

### System information

Godot v4.1.rc2 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.3623) - AMD Ryzen 7 5700G with Radeon Graphics (16 Threads)

### Issue description

When setting the AnimationTree to active, Godot crashes.

### Steps to reproduce

https://github.com/godotengine/godot/assets/46705245/dbe5eb81-1357-43e8-ac80-a4eb97eea9fc

### Minimal reproduction project

[Crash.zip](https://github.com/godotengine/godot/files/11945826/Crash.zip)

state_machine_type = p_state_machine_type;
	emit_changed();
	emit_signal(SNAME("tree_changed"));
	notify_property_list_changed();
}
AnimationNodeStateMachine::StateMachineType AnimationNodeStateMachine::get_state_machine_type() const {
	return state_machine_type;
}
void AnimationNodeStateMachine::set_allow_transition_to_self(bool p_enable) {
	allow_transition_to_self = p_enable;
}
bool AnimationNodeStateMachine::is_allow_transition_to_self() const {
	return allow_transition_to_self;
}
void AnimationNodeStateMachine::set_reset_ends(bool p_enable) {
	reset_ends = p_enable;
}
bool AnimationNodeStateMachine::are_ends_reset() const {
	return reset_ends;
}
bool AnimationNodeStateMachine::can_edit_node(const StringName &p_name) const {
	if (states.has(p_name)) {
		return !(states[p_name].node->is_class("AnimationNodeStartState") || states[p_name].node->is_class("AnimationNodeEndState"));
	}
	return true;
}
Ref<AnimationNode> AnimationNodeStateMachine::get_node(const StringName &p_name) const {