I'm not sure how well this works on newer versions of Android (probably not at all), but you used to be able to use a Tasker application context and the Secure Settings System+ module to automatically switch the IME depending on what application was active.