Heat oil in a large pan over medium-high heat; sauté green onions, ginger, and garlic until fragrant, about 1 minute.
Add fermented black beans, Doubanjiang, chili flakes, and Sichuan peppercorns; cook briefly for 30 seconds.
Stir in mushrooms, tofu, vegetable stock, five-spice powder, and sugar; bring to a simmer and cook 5–7 minutes.
Add cornstarch slurry while stirring gently to avoid breaking tofu pieces.
Cook until sauce is glossy and tofu is heated through, about 2 minutes.
Garnish with chili oil if desired and serve immediately over steamed rice.