v1.2.1: fix race condition in \newcommand scope fix

On Firefox, it was possible for the initial typeset pass to start
before the begingroup extension was loaded, causing the fix not to
be applied to the initial typeset. I now register the hook that
injects the reset commands immediately, and mark the reset command
as requiring the begingroup extension.
v1.3.1: merge v1.2.1 from master branch, +1 fix