### Godot version

v4.1.dev3.official [a67d37f7c]

### System information

Windows 10 64-bit

### Issue description

When trying to rename anything (a scene, script, folder, etc) instead of selecting the item itself, it highlights the current folder in the FileSystem tab instead.

Upon pressing enter or confirm the name change a Warning dialogue appears with the following text:

> This file extension is not recognized by the editor.
If you want to rename it anyway, use your operating system's file manager.
After renaming to an unknown extension, the file won't be shown in the editor anymore.

If no new text is entered, the warning box instead states

> Name contains invalid characters.

Upon pressing Ok, the folder name in the FileSystem tab is visually changed to match the name of the item you attempted to rename (regardless of the entered text) including the extension if any. The folder name remains the same in the file system, but visually in the editor it is the name of the item.
In the output log, there is a message
> scene/main/viewport.cpp:3005 - Condition "!is_inside_tree()" is true.

![sample](https://github.com/godotengine/godot/assets/9257713/35ee2446-507b-4cfb-a9ab-6d46ae484feb)

### Steps to reproduce

1. Create or open a project
2. Rename any item (scene, script, folder, etc) by right clicking or pressing F2 (or corresponding shortcut for rename)

### Minimal reproduction project

N/A
ti->set_icon_modulate(0, color);
			ti->set_tooltip_text(0, favorite);
			ti->set_selectable(0, true);
			ti->set_metadata(0, favorite);
			if (p_select_in_favorites && favorite == current_path) {
				ti->select(0);
				ti->set_as_cursor(0);
			}
			if (!favorite.ends_with("/")) {
				Array udata;
				udata.push_back(tree_update_id);
				udata.push_back(ti);
				EditorResourcePreview::get_singleton()->queue_resource_preview(favorite, this, "_tree_thumbnail_done", udata);
			}
		}
	}
	Vector<String> uncollapsed_paths = p_uncollapsed_paths;
	if (p_uncollapse_root) {
		uncollapsed_paths.push_back("res://");
	}
	
	_create_tree(root, EditorFileSystem::get_singleton()->get_filesystem(), uncollapsed_paths, p_select_in_favorites, p_unfold_path);
	tree->ensure_cursor_is_visible();
	updating_tree = false;
}
void FileSystemDock::set_display_mode(DisplayMode p_display_mode) {
	display_mode = p_display_mode;
	_update_display_mode(false);
}
void FileSystemDock::_update_display_mode(bool p_force) {