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

int base_ofs = children_pos.y - theme_cache.offset.y + p_draw_ofs.y;
		int prev_ofs = base_ofs;
		int prev_hl_ofs = base_ofs;
		while (c) {
			int child_h = -1;
			int child_self_height = 0;
			if (htotal >= 0) {
				child_h = draw_item(children_pos, p_draw_ofs, p_draw_size, c, child_self_height);
				child_self_height += theme_cache.v_separation;
			}
			
			if (theme_cache.draw_relationship_lines > 0 && (!hide_root || c->parent != root) && c->is_visible()) {
				int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? theme_cache.h_separation : theme_cache.item_margin);
				int parent_ofs = p_pos.x + theme_cache.item_margin;
				Point2i root_pos = Point2i(root_ofs, children_pos.y + child_self_height / 2) - theme_cache.offset + p_draw_ofs;
				if (c->get_visible_child_count() > 0) {
					root_pos -= Point2i(theme_cache.arrow->get_width(), 0);
				}
				float line_width = theme_cache.relationship_line_width * Math::round(theme_cache.base_scale);
				float parent_line_width = theme_cache.parent_hl_line_width * Math::round(theme_cache.base_scale);
				float children_line_width = theme_cache.children_hl_line_width * Math::round(theme_cache.base_scale);
				Point2i parent_pos = Point2i(parent_ofs - theme_cache.arrow->get_width() / 2, p_pos.y + label_h / 2 + theme_cache.arrow->get_height() / 2) - theme_cache.offset + p_draw_ofs;
				int more_prev_ofs = 0;
				if (root_pos.y + line_width >= 0) {
					if (rtl) {
						root_pos.x = get_size().width - root_pos.x;
						parent_pos.x = get_size().width - parent_pos.x;
					}
					
					if (_is_branch_selected(c)) {