optimizer: transform ((begin ... proc) x) to (begin ... (proc x))

Currently the optimizer can convert ((let (...) ... proc) x) to
(let (...) ... (proc x)). This is useful especially if proc can be
inlined. Extend this to begin's forms.