This is because, when using a scripting function in the replacement part of the $regexp function, the scripting function is evaluated before the replacement occurs. This is due to the evaluation order of the scripting language.
The action Replace with Regular Expression supports scripting functions in the replacement part.
This won't work on macOS, because the underlying ICU regular expression engine does not support \u.
In my experiments, the Java 8 flavour on regex101 is the closest match to simulate the behaviour of ICU.