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

}
			}
		}
		if (!p_item->disable_folding && !hide_folding && p_item->first_child && p_item->get_visible_child_count() != 0) { 
			Ref<Texture2D> arrow;
			if (p_item->collapsed) {
				if (is_layout_rtl()) {
					arrow = theme_cache.arrow_collapsed_mirrored;
				} else {
					arrow = theme_cache.arrow_collapsed;
				}
			} else {
				arrow = theme_cache.arrow;
			}
			Point2 apos = p_pos + Point2i(0, (label_h - arrow->get_height()) / 2) - theme_cache.offset + p_draw_ofs;
			apos.x += theme_cache.item_margin - arrow->get_width();
			if (rtl) {
				apos.x = get_size().width - apos.x - arrow->get_width();
			}
			arrow->draw(ci, apos);
		}
	}
	Point2 children_pos = p_pos;
	if (!skip) {
		children_pos.x += theme_cache.item_margin;
		htotal += label_h;
		children_pos.y += htotal;
	}
	if (!p_item->collapsed) { 
		TreeItem *c = p_item->first_child;