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

TreeItem *current = get_parent();
	if (!current) {
		return;
	}
	bool any_checked = false;
	bool any_unchecked = false;
	bool any_indeterminate = false;
	TreeItem *child_item = current->get_first_child();
	while (child_item) {
		if (!child_item->is_checked(p_column)) {
			any_unchecked = true;
			if (child_item->is_indeterminate(p_column)) {
				any_indeterminate = true;
				break;
			}
		} else {
			any_checked = true;
		}
		child_item = child_item->get_next();
	}
	if (any_indeterminate || (any_checked && any_unchecked)) {
		current->set_indeterminate(p_column, true);
	} else if (current->is_indeterminate(p_column) && !any_checked) {
		current->set_indeterminate(p_column, false);
	} else {
		current->set_checked(p_column, any_checked);
	}