### Godot version

4.1.dev (1becfea37c)

### System information

MacOS 13.3 M1 Pro

### Issue description

When renaming with Batch Rename using invalid character `NodePath` will be updated with the invalid new name.

### Steps to reproduce

1.  open MRP
2. batch rename all nodes except the root from `e` to `%`
3. look at the `NodePath` on the root

### Minimal reproduction project

[test1.zip](https://github.com/godotengine/godot/files/11377324/test1.zip)

item->set_custom_color(0, get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
			item->set_selectable(0, false);
		}
	}
}
void SceneTreeEditor::_node_visibility_changed(Node *p_node) {
	if (!p_node || (p_node != get_scene_node() && !p_node->get_owner())) {
		return;
	}
	TreeItem *item = _find(tree->get_root(), p_node->get_path());
	if (!item) {
		return;
	}
	int idx = item->get_button_by_id(0, BUTTON_VISIBILITY);
	ERR_FAIL_COND(idx == -1);
	bool node_visible = false;
	if (p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
		node_visible = p_node->call("is_visible");
		CanvasItemEditor::get_singleton()->get_viewport_control()->queue_redraw();
	} else if (p_node->is_class("Node3D")) {
		node_visible = p_node->call("is_visible");
	}
	if (node_visible) {
		item->set_button(0, idx, get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons")));
	} else {
		item->set_button(0, idx, get_theme_icon(SNAME("GuiVisibilityHidden"), SNAME("EditorIcons")));
	}
	_update_visibility_color(p_node, item);
}
void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) {