Bring a large pot of well-salted water to a boil. In a small bowl, whisk together the soy sauce, rice vinegar, sesame oil, and 2 Tbs. of the peanut oil.
Set a large skillet or wok over medium-high heat. When the pan is hot, pour in 1-1/2 Tbs. of the peanut oil and, after a few seconds, add the garlic, ginger, and chile flakes. Stir for 20 seconds, making sure that the garlic doesn't burn. Add the mushrooms and stir-fry until they soften, 2 to 3 min. Add the sherry and cook for another 30 seconds. Season with salt and pepper and transfer the mixture to a bowl. Reduce the heat to medium, heat the remaining 1-1/2 Tbs. oil in the pan, and add the onions. Season with salt and then sauté them, stirring often, until they're soft and slightly caramelized, 9 to 10 min. Add the spinach, cover the pan, and steam, shaking the pan occasionally, until the spinach wilts, about 3 minutes. Remove and discard the garlic from the mushrooms, put the mushrooms back in the pan, and toss. Remove from the heat and season lightly with salt and pepper. Reserve until needed.
Cook the orzo in the boiling water until it's just tender, about 9 min. Drain it well and put it in a large bowl. Add the mushroom mixture, soy vinaigrette, scallions, and sesame seeds (if using) and toss. Taste and season. Serve hot, warm, or at room temperature, with lime wedges to squeeze over the pasta.