Cook the penne according to the package directions.
Meanwhile, heat the oil in a large saucepan over medium heat. Add the onions, 1/2 teaspoon of the salt, and 1/4 teaspoon of the pepper and cook, covered, until the onions are softened, about 8 minutes. Add the garlic and mushrooms and cook, covered, for 6 minutes more. Add the wine and cook, uncovered, for 3 minutes. Stir in the escarole (if using) and chopped herbs, season with the remaining salt and pepper, and cook for 4 minutes. Add the tomatoes and heat through. Stir in the basil.
Transfer the pasta to plates, spoon the sauce over the top, and sprinkle with the cheese.
Tip: Although Parmesan and Pecorino Romano are often used interchangeably, they're quite different. If you prefer a richer, more buttery flavor, use Parmesan; for a saltier, sharper bite, try Pecorino Romano.