Substitutes all free occurrences of variable name with replacement in term, while avoiding variable capture: substitution stops at lambdas that rebind name, and lambdas whose binder is free in replacement are alpha-renamed first. Also used by LetRecLoweredValue to rewrite recursive references into self-application.