In a medium skillet over medium heat, warm 2 tablespoons of the oil. Add the onion and a pinch of salt. Cook until softened, about 3 to 5 minutes. Add the mushrooms, garlic, and red pepper flakes. Raise the heat to high and cook, stirring frequently, until the mushrooms have given off their juices and are lightly caramelized, about 4 to 5 minutes. Transfer the vegetables to the work bowl of a food processor. Add the tofu, egg and 1/2 teaspoon of salt and pulse to combine. Add the bread crumbs and parsley and pulse to combine again. Scrape the mixture into a bowl and season with plenty of freshly ground black pepper. Spread the flour on a plate. Moisten your hands with water and form the tofu mixture into 1 1/2-inch balls. Lightly coat the balls in flour and put them onto a baking sheet or large plate. In a large skillet over medium heat, warm the remaining 2 tablespoons oil. Add the balls and cook them until browned all over, about 3 to 4 minutes on each side. Add the tomato sauce to the pan and simmer until the balls are firm and cooked through, about 15 minutes. Serve with your favorite pasta.
Put all the ingredients into the bowl of a food processor and pulse to form a rough puree with flecks of basil.