Toast the walnuts in a dry 20 cm / 8-inch skillet over medium heat for 5 to 6 minutes, stirring often, until fragrant and a shade darker. Tip them onto a plate and cool for 5 minutes.
Pulse the mushrooms in a food processor in two or three batches, about five one-second pulses each, until the pieces are the size of lentils. Pulse the cooled walnuts 4 to 5 times into coarse crumbs. Pulse the onion, carrot, and celery together about 8 times until finely chopped.
Heat 2 tablespoons of the oil in a 28 cm / 11-inch Dutch oven over medium-high heat. Add the mushrooms and 1/2 teaspoon of the salt. Cook for 12 to 14 minutes, stirring every minute or two, until the liquid has cooked off and the mushrooms are deep brown and starting to stick to the bottom. If they still look pale and wet, keep going, because stopping early gives a flat, steamed-tasting sauce.
Stir in the remaining 1 tablespoon oil, the onion mixture, and the remaining 1/2 teaspoon salt. Cook for 6 to 7 minutes until softened. Add the garlic, tomato paste, smoked paprika, and thyme, and cook for 2 minutes until the paste darkens to brick red and smells fragrant.
Pour in the wine and scrape up the browned bits for 1 to 2 minutes until it's almost gone. Add the walnuts, crushed tomatoes, broth, soy sauce, balsamic vinegar, and pepper. Bring to a simmer, reduce to low, and cook partially covered for 20 minutes, stirring every 5 minutes, until a spoon dragged across the bottom leaves a clear trail. Taste and adjust the salt.
When the sauce has about 10 minutes left, boil the spaghetti or rigatoni in a 6-quart / 5.7 L pot of water with 1 tablespoon salt until 1 minute short of the package time. Reserve 120 ml of the pasta water, then drain. Stir the pasta into the sauce with the reserved water over medium-low heat for 1 minute until glossy. Top with parsley and serve.