Hot and Sour Peanutty Noodles with Bok Choy

8 ounces whole-wheat spaghetti
2 1/4 teaspoons kosher salt, divided
1 tablespoon canola or sunflower oil
1 large shallot or red onion, sliced
1 piece (about 1 inch) ginger, peeled and finely chopped
1 pound bok choy, leaves and stems separated, roughly chopped
1 red bell pepper, sliced (optional, not in season)
3/4 cup vegetable stock or water
2 tablespoons soy sauce
1 tablespoon dark sesame oil
1 tablespoon rice vinegar
1/2 cup chopped unsalted roasted peanuts
1/4 teaspoon red pepper flakes (or more to taste)

Cook pasta as directed on package with 2 teaspoons salt until just tender. Drain and rinse pasta with cool water. In a large nonstick skillet, heat canola oil over medium-high heat. Cook shallot and ginger, stirring, until just brown, 1 minute. Add bok choy stems, bell pepper and remaining 1/4 teaspoon salt. Cook, stirring frequently, until peppers are crisp-tender, 1 to 2 minutes. Transfer contents of skillet to a plate. To same skillet, add bok choy leaves, stock, soy sauce, sesame oil and vinegar. Cook, stirring, until leaves are soft and bright green, 1 to 2 minutes. Add bell pepper mixture, pasta, peanuts and pepper flakes to pan. Toss to combine; serve.