I find that on HP Elite x2 1013 G3 first detaching and attaching keyboard doesn't generate SW_TABLET_MODE events from intel-vbtn driver. Second and following detaching/attaching keyboard does generate correct SW_TABLET_MODE events, so probably it's some problem only with initial / first events.
Issue is not reproducible in two following cases:
1. If I suspend/resume tablet before detaching or attaching keyboard.
2. If I flip keyboard behind the screen instead of detaching it.
Please let me know what information I need to provide to help resolve this.
Relevant bugreport: Bug 204739