For me, this was caused by the touchpad/keyboard being incorrectly registered as external devices. The disabling when typing behaviour is only for internal input devices.
To fix it I did the following:
Make sure libinput-tools is installed, sudo apt install libinput-tools
Then sudo libinput list-devices
This gives you a list of devices from libinput, such as keyboards and touchpads
You'll want to take note of the Kernel item for your keyboard and touchpad. It may be a bit tricky to figure out which ones you need, I had 2 entries for my keyboard, an entry for my touchpad, and an entry for mouse, while not having a mouse plugged in.
Then for each of the Kernel paths, run the following
sudo libinput quirks list /dev/input/event7 (replacing the path)
Take note of the devices where this command DOES NOT output AttrKeyboardIntegration=internal. If all devices output this, this solution will not work.
Finally, create a file /etc/libinput/local-overrides.quirks
[Name of overwrite, doesn't matter much]
MatchUdevType=keyboard
MatchName=NAME OF DEVICE
AttrKeyboardIntegration=internal
Where MatchName is equal to the Device item of sudo libinput list-devices
MatchUdevType should be the type of device. keyboard, touchpad & mouse did the trick for me.
Add a separate entry for each device that did not output AttrKeyboardIntegration=internal previously