### Godot version

4.1.stable

### System information

Windows 11 (x64), Intel(R) Core(TM) i5-9400 CPU, Vulkan,  NVIDIA GeForce GTX 1660 Ti driver version 528.24

### Issue description

Every time you right click the Filter Nodes field, it duplicates the 'Filters' section in the dropdown.

https://github.com/godotengine/godot/assets/104696964/b8d867c9-ba31-47c5-91c8-23cfa02f1c89



### Steps to reproduce

Rightclick the Filter Nodes field.

### Minimal reproduction project

N/A
button_tree_menu = memnew(MenuButton);
	button_tree_menu->set_flat(true);
	button_tree_menu->set_tooltip_text(TTR("Extra scene options."));
	button_tree_menu->connect("about_to_popup", callable_mp(this, &SceneTreeDock::_update_tree_menu));
	filter_hbc->add_child(button_tree_menu);
	PopupMenu *tree_menu = button_tree_menu->get_popup();
	tree_menu->connect("id_pressed", callable_mp(this, &SceneTreeDock::_tool_selected).bind(false));
	button_hb = memnew(HBoxContainer);
	vbc->add_child(button_hb);
	edit_remote = memnew(Button);
	edit_remote->set_flat(true);
	button_hb->add_child(edit_remote);
	edit_remote->set_h_size_flags(SIZE_EXPAND_FILL);
	edit_remote->set_text(TTR("Remote"));
	edit_remote->set_toggle_mode(true);
	edit_remote->set_tooltip_text(TTR("If selected, the Remote scene tree dock will cause the project to stutter every time it updates.\nSwitch back to the Local scene tree dock to improve performance."));
	edit_remote->connect("pressed", callable_mp(this, &SceneTreeDock::_remote_tree_selected));
	edit_local = memnew(Button);
	edit_local->set_flat(true);
	button_hb->add_child(edit_local);
	edit_local->set_h_size_flags(SIZE_EXPAND_FILL);
	edit_local->set_text(TTR("Local"));
	edit_local->set_toggle_mode(true);
	edit_local->set_pressed(true);
	edit_local->connect("pressed", callable_mp(this, &SceneTreeDock::_local_tree_selected));
	remote_tree = nullptr;
	button_hb->hide();
	create_root_dialog = memnew(VBoxContainer);
	vbc->add_child(create_root_dialog);
	create_root_dialog->set_v_size_flags(SIZE_EXPAND_FILL);