Here's what I do in similar circumstances. Create another variable,
$wgScriptPathEscaped. Then, gradually make the changes. Wait for tests.
Change some more. Eventually, most of the old ones will be gone.
By inspection, many of the uses will be terminal, not passed to other
routines, with no side effects. Those should be done first.
Sure, it might take a month or three. But wishing for some universal
regression suite is going to be about the same as waiting for the
single pass parser.