If it is set up correctly, i guess that approach would be ok... It's still a tad bit early for me, but for now i don't see any real problem...
Would it be possible for the MITM to change the code that is being used to compromise the client's private key? I'm no expert on this, but in my understanding, the code that generates the private key locally can be read by the MITM, right?
yes... I didn't think about this attack vector... But it's true... Every package you sent is encrypted using a symmetric key shared between the client and cloudflare, then cloudflare decrypts the packages and re-encrypts them using a symmetric key shared between cloudflare and the host.
Cloudflare can, in theory, inject malicious code into any website that uses their proxy... Including but not limited to the code used to generate keypairs.