The keyboard and touchpad are disabled by the firmware (EC) which works independently of the OS.
But additionally libinput also disables them if it receives SWITCH_TOGGLE tablet mode.
This is handled by the soc_button_array kernel driver.
Some rostros, e.g. Arch load pinctrl_tigerlake as a module instead of building it into the kernel.
soc_button_array must load after that module. You can manually unload and reload it:
sudo rmmod soc_button_array && sudo modprobe soc_button_array
Or add pinctrl_tigerlake to your initramfs