kinit() sets up the XKB extension, after which the server stops sending core MappingNotify to this client, so the refresh branch never fired and strans kept its startup keymap; setxkbmap after launch left every XIM key resolved against the old layout. Select XKB NewKeyboardNotify and MapNotify (with the map parts, or MapNotify is never delivered) and rebuild the keymap on those events instead.