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

valid_types = p_valid;
}
void SceneTreeEditor::set_editor_selection(EditorSelection *p_selection) {
	editor_selection = p_selection;
	tree->set_select_mode(Tree::SELECT_MULTI);
	tree->set_cursor_can_exit_tree(false);
	editor_selection->connect("selection_changed", callable_mp(this, &SceneTreeEditor::_selection_changed));
}
void SceneTreeEditor::_update_selection(TreeItem *item) {
	ERR_FAIL_COND(!item);
	NodePath np = item->get_metadata(0);
	if (!has_node(np)) {
		return;
	}
	Node *n = get_node(np);
	if (!n) {
		return;
	}
	if (editor_selection->is_selected(n)) {
		item->select(0);
	} else {
		item->deselect(0);
	}
	TreeItem *c = item->get_first_child();
	while (c) {
		_update_selection(c);
		c = c->get_next();
	}
}
void SceneTreeEditor::_selection_changed() {