\scantokens was unsupported and leaked its group. Handle it in the expansion
loop: parse the braced argument, replace the command with the group text (after
the command-end marker so it cannot merge with a preceding control word), and
let the remaining passes re-tokenise and expand it like ordinary source.
A preview test defines \greet, runs \scantokens{\greet world}. and checks
"Hello world." with no warnings and no leaked command.