In a heavy bottomed skillet, melt 4 tablespoons butter over medium heat. Add red onions and cook for about 2 minutes, until they start to soften. Add squash and ½ teaspoon salt. Cook until squash starts to brown, about 5 minutes. Pour in stock, bring to a simmer, reduce heat and cook for about 5 more minutes.
Meanwhile, make the sauce. In a small saucepan, melt remaining 2 tablespoons of butter. Remove from heat and whisk in flour until a thick paste forms. Slowly add milk, whisking constantly. Return saucepan to heat and continue to whisk until mixture starts to thicken, about 3 minutes. Remove from heat and stir in 1 teaspoon salt, Dijon mustard, and half of the cheese.
Transfer squash and onions to a 9 x 13 inch baking dish. Add tomatoes, tucking them all around the squash and between layers, so their evenly spread throughout the baking dish. Pour sauce on top and use a wooden spoon to mix throughout. Top gratin with remaining cheese and parsley.
Bake for 15 minutes until squash is soft and cooked through. Turn broiler on high and finish under the broiler for 5 minutes, so cheese starts to brown. Let cool for 10 minutes before serving.