Runtime expansion only understood \def/\gdef. Add \let\alias=\target (a macro
body that expands to the target) and \chardef\name=<code> (a one-character
body), both honoring the current scope, so class-style aliases work and can be
shadowed inside a group.
Line-based capture also still pulled a definition line out of a group and made
it global. Track brace depth across body lines and only capture at depth zero,
and restrict strip_page_geometry's definition capture to the preamble before
\begin{document}; body lines now reach runtime expansion where the scope stack
applies.
Tests preview a group-local \def on its own line as "twoone" and
\let/\chardef as "HiandA".