How to synthesize a lambda in Core?

In short : I’d like to construct functions using Core building blocks. I suspect my use of mkCoreApps is inconsistent, but I’d really appreciate some expert eyes on it.

Once I get this right, I’ll document the technique in a follow up blog post.

I have put a pretty detailed description with repro steps on SO :

Thanks in advance!