Yes, you can create stages in Super Mario Maker 2 when your Switch is docked. Most people will opt for the handheld route though, as creating a stage seems to be a bit more intuitive when using a touch-based approach. When you're in handheld mode, it turns out your only option will be the touch screen. Hands-on reports state that you simply can't use the buttons to build a stage when running handheld mode.
We're not quite sure if the same goes for tabletop mode, which means there could be a workaround for those who want portability mixed with button-controlled level creation. You'll just have to detach the Joy-Con and set up your Switch somewhere.