For a better understanding, this is how I plan the internal interface to be: https://gitlab.winehq.org/rbernon/wine/-/blob/wip/ime/include/wine/ime.h
The host IME would call back into the IME by sending the messages to the right IME UI window. They need to be able to make changes to an HIMC from any thread, and this which will allow to delegate the operations to the owning thread.
For some implementations, the PE IME needs to call into the driver unix side, for instance to pass keys to be processed. It could be done by keeping ImeProcessKey export and a driver specific unixlib interface, but this new imm32 unixlib let us factor this into imm32.dll, and also lets us target other host IME, like IBus, directly instead of going through the user drivers, using the same unixlib interface.