Fixes #19109. Adding the polyfill adds ~0.3K to gzipped assets. Alternatively we could just remove the use and maybe in UI tests add a String.prototype.replaceAll
function that displays an error on screen to catch other uses. Adding the polyfill was the simpler fix.