Preheat the oven to 375.
Bring a large pot of water to a boil. Thinly slice the onions and place in a skillet over medium heat. As soon as they start to stick, swirl in half of the butter and half of the olive oil. Saute for another 10-15 minutes until lightly caramelized.
Remove the onions and place in a pot with the diced tomatoes and dried Italian herbs over low heat. Break apart the tomatoes a bit as needed.
Add the remaining butter & olive oil to the now empty skillet. Once melted, swirl in the chopped walnuts with a generous pinch of salt and the minced garlic. Reduce the heat from medium to low and allow the garlic and walnuts to meld flavors, toss occasionally to prevent the garlic or nuts from burning. Once cooked through and flavorful, remove half of the nuts and set aside.
Once the water is boiling add the pasta and cook for about 6-8 minutes until el dente, according to the package directions.
Fold the chopped dark, leafy greens in with the nuts to wilt in the heat.
Strain the pasta and toss with half of the garlic walnuts and the cooked greens. Once evenly tossed, fold in half of the mozzarella, if using. Spread into a casserole dish (small if using the original recipe, larger if you increase the servings). Top with the remaining mozzarella, if using. Bake for about 15 minutes until the cheese is melted. Sprinkle the melted cheese with the remaining garlic walnuts and finish with a scatter of the (optional) grated parmesan across the top. Bake for another 5 minutes.
This dish can be made ahead. Just skip baking it and store it in the casserole dish covered.
If starting from a cold pasta bake, at least double the bake time.