### Godot version

4.2 Stable

### System information

Linux

### Issue description

Calling TreeItem set_text() on a TreeItem that was removed via remove_child() causes debugging to end and the application to close without any error message.

### Steps to reproduce

Run the included example to get the debugger to crash. Comment out "treeItem.remove_child(subTreeItem)" for normal behaviour. 

### Minimal reproduction project

[treeItemCrash.zip](https://github.com/godotengine/godot/files/13534005/treeItemCrash.zip)

y_ofs += child_h;
				c = c->next;
				item_h += child_h;
			}
		}
		if (p_item == root) {
			emit_signal(SNAME("empty_clicked"), get_local_mouse_position(), p_button);
		}
	}
	return item_h; 
}
void Tree::_text_editor_popup_modal_close() {
	if (Input::get_singleton()->is_key_pressed(Key::ESCAPE) ||
			Input::get_singleton()->is_key_pressed(Key::KP_ENTER) ||
			Input::get_singleton()->is_key_pressed(Key::ENTER)) {
		return;
	}
	if (value_editor->has_point(value_editor->get_local_mouse_position())) {
		return;
	}
	if (!popup_edited_item) {
		return;
	}
	if (popup_edited_item->is_edit_multiline(popup_edited_item_col) && popup_edited_item->get_cell_mode(popup_edited_item_col) == TreeItem::CELL_MODE_STRING) {
		_apply_multiline_edit();
	} else {
		_line_editor_submit(line_editor->get_text());
	}
}
void Tree::_text_editor_gui_input(const Ref<InputEvent> &p_event) {