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

but_insert_name->set_tooltip_text(String("${NAME}\n") + TTR("Node name."));
	but_insert_name->set_focus_mode(Control::FOCUS_NONE);
	but_insert_name->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${NAME}"));
	but_insert_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_name);
	
	but_insert_parent = memnew(Button);
	but_insert_parent->set_text("PARENT");
	but_insert_parent->set_tooltip_text(String("${PARENT}\n") + TTR("Node's parent name, if available."));
	but_insert_parent->set_focus_mode(Control::FOCUS_NONE);
	but_insert_parent->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${PARENT}"));
	but_insert_parent->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_parent);
	
	but_insert_type = memnew(Button);
	but_insert_type->set_text("TYPE");
	but_insert_type->set_tooltip_text(String("${TYPE}\n") + TTR("Node type."));
	but_insert_type->set_focus_mode(Control::FOCUS_NONE);
	but_insert_type->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${TYPE}"));
	but_insert_type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_type);
	
	but_insert_scene = memnew(Button);
	but_insert_scene->set_text("SCENE");
	but_insert_scene->set_tooltip_text(String("${SCENE}\n") + TTR("Current scene name."));
	but_insert_scene->set_focus_mode(Control::FOCUS_NONE);
	but_insert_scene->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${SCENE}"));
	but_insert_scene->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_scene);