In the bowl of a food processor, combine 2 1/2 cups flour, 1 teaspoon salt, 1 teaspoon granulated sugar, and 1 cup Gruyere cheese. Add 1 cup butter; process until mixture resembles coarse meal, 8 to 10 seconds.
With machine running, pour ice water (about 1/4 cup) little by little through feed tube. Pulse until dough holds together without becoming wet or sticky; be careful not to process more than 30 seconds. To test, squeeze a small amount together: If it is crumbly, add more ice water, 1 tablespoon at a time.
Divide dough into two equal balls. Flatten each into a disk; wrap in plastic. Transfer to refrigerator; chill 1 hour.
Melt remaining tablespoon butter in large skillet over medium heat. Add onion and garlic. Cook, stirring occasionally, until translucent and softened, 5 to 7 minutes. Transfer to a bowl to cool slightly.
Place tomatoes in a large bowl. Toss with remaining 1/4 cup plus 2 tablespoons flour, 1 1/2 teaspoons salt, and 1 1/2 teaspoons granulated sugar, and basil and pepper. When onion mixture is cooled, add to tomato mixture, and toss to combine. Transfer mixture to a deep 9 1/2- or 10-inch pie dish. Set aside.
Heat oven to 375 degrees. Roll out half the dough into a circle 1 inch larger than pie dish. Remaining dough may be frozen up to 1 month. Transfer rolled dough to top of dish; tuck in edges to seal. Make three to four small slits in crust; form a decorative edge if desired. In small bowl, mix egg with 1 teaspoon water. Brush egg glaze over crust; sprinkle crust with remaining 1/4 cup cheese. Place pie dish on a baking sheet to catch drips; bake until crust is golden and insides are bubbling, about 50 minutes. Let cobbler cool before serving.