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

String search = lne_search->get_text();
	String replace = lne_replace->get_text();
	String prefix = lne_prefix->get_text();
	String suffix = lne_suffix->get_text();
	String new_name = node->get_name();
	if (cbut_substitute->is_pressed()) {
		search = _substitute(search, node, count);
		replace = _substitute(replace, node, count);
		prefix = _substitute(prefix, node, count);
		suffix = _substitute(suffix, node, count);
	}
	if (cbut_regex->is_pressed()) {
		new_name = _regex(search, new_name, replace);
	} else {
		new_name = new_name.replace(search, replace);
	}
	new_name = prefix + new_name + suffix;
	if (cbut_process->is_pressed()) {
		new_name = _postprocess(new_name);
	}
	return new_name;
}
String RenameDialog::_substitute(const String &subject, const Node *node, int count) {