I think these are details to fix later, they are currently broken and this MR doesn't fix it but also doesn't make it worse.
This report was not meant to say anything that needs to be resolved in this MR, it's just information. I apologize for tainting the MR.
For better compatibility and to workaround the host IME quirks, I think it'd be better to simply implement all of this on the PE side.
Yes, the current Wine built-in ime structure is going in a good direction, so as long as the PE-UNIX interface is well designed, it can easily be combined with libhangul, etc.
It doesn't even require a lot of additional code. Even if application issues arise, Wine will be in full control.