### Godot version

v4.2.dev3.official [013e8e3af]

### System information

Windows 10, 64bit

### Issue description

![image](https://github.com/godotengine/godot/assets/35988767/ccdac68c-a60d-491b-a406-d6e3bc1c95ae)
![GIF](https://github.com/godotengine/godot/assets/35988767/7d230faf-0260-4bc3-92e8-11cd026931a8)


### Steps to reproduce

/

### Minimal reproduction project

/
Container::remove_child_notify(p_child);
	if (p_child == tab_bar) {
		return;
	}
	Control *c = Object::cast_to<Control>(p_child);
	if (!c || c->is_set_as_top_level()) {
		return;
	}
	int idx = get_tab_idx_from_control(c);
	
	children_removing.push_back(c);
	tab_bar->remove_tab(idx);
	children_removing.erase(c);
	_update_margins();
	if (get_tab_count() == 0) {
		queue_redraw();
	}
	p_child->remove_meta("_tab_name");
	p_child->disconnect("renamed", callable_mp(this, &TabContainer::_refresh_tab_names));
	
	if (!is_inside_tree()) {
		call_deferred("_repaint");
	}
}
int TabContainer::get_tab_count() const {