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

}
		const TreeItem::Cell &c = p_item->cells[col];
		if (!cache.rtl && !p_item->cells[col].buttons.is_empty()) {
			int button_w = 0;
			for (int j = p_item->cells[col].buttons.size() - 1; j >= 0; j--) {
				Ref<Texture2D> b = p_item->cells[col].buttons[j].texture;
				button_w += b->get_size().width + theme_cache.button_pressed->get_minimum_size().width + theme_cache.button_margin;
			}
			col_width = MAX(button_w, MIN(limit_w, col_width));
		}
		for (int j = c.buttons.size() - 1; j >= 0; j--) {
			Ref<Texture2D> b = c.buttons[j].texture;
			int w = b->get_size().width + theme_cache.button_pressed->get_minimum_size().width;
			if (x > col_width - w) {
				if (c.buttons[j].disabled) {
					pressed_button = -1;
					cache.click_type = Cache::CLICK_NONE;
					return -1;
				}
				
				Point2 click_pos = get_global_mouse_position() - get_global_position();
				if (!get_item_at_position(click_pos)) {
					pressed_button = -1;
					cache.click_type = Cache::CLICK_NONE;
					return -1;
				}
				pressed_button = j;
				cache.click_type = Cache::CLICK_BUTTON;
				cache.click_index = j;
				cache.click_id = c.buttons[j].id;