builder: handle escapes without swallowing all of them.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
builder: whitelist verbs useful for environment replacement.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Merge pull request #8778 from erikh/builder_fixes

Builder: Environment replacement fixes