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

EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
	Array selected_node_list = editor_selection->get_selected_nodes();
	Node *root_node = SceneTree::get_singleton()->get_edited_scene_root();
	global_count = spn_count_start->get_value();
	to_rename.clear();
	
	_iterate_scene(root_node, selected_node_list, &global_count);
	if (!to_rename.is_empty()) {
		EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
		undo_redo->create_action(TTR("Batch Rename"));
		
		for (int i = to_rename.size() - 1; i >= 0; --i) {
			Node *n = root_node->get_node(to_rename[i].first);
			const String &new_name = to_rename[i].second;
			if (!n) {
				ERR_PRINT("Skipping missing node: " + to_rename[i].first.get_concatenated_subnames());
				continue;
			}
			scene_tree_editor->emit_signal(SNAME("node_prerename"), n, new_name);
			undo_redo->add_do_method(scene_tree_editor, "_rename_node", n->get_instance_id(), new_name);
			undo_redo->add_undo_method(scene_tree_editor, "_rename_node", n->get_instance_id(), n->get_name());
		}
		undo_redo->commit_action();
	}
}
void RenameDialog::reset() {