Add tests for new letrec semantics.

Closes existing bugs because the old broken semantics is now right
because of undefined changes.

Closer PR 13303.
Closer PR 13333.