Settings -> System -> Keyboard -> On-screen keyboard -> Gboard (click on the name, on the left side) then
* Physical keyboard -> turn on "Show on-screen keyboard"
* Go back one level (to Gboard's setting) -> Write in text fields -> turn off "Use stylus to write in text fields"