\afterassignment<token> leaked because assignment processing happens in later
passes. Add a rewrite after the body is extracted: find \afterassignment, read
its token, locate the following assignment (a \def/\gdef through
runtime_definition, or the next top-level '=' plus its value token), and move
the command before the assignment's follower so the assignment passes run
first. The queued token stays in the stream for normal expansion.
A preview test queues \hello before \a=5 and checks H appears, Text. still
renders and no \afterassignment leaks.