Preheat the oven to 400°F.
Shave or thinly slice the fennel bulb crosswise, and set aside the feathery fronds for later.
Quarter and core the apples, then slice them into thin wedges. Sprinkle the apple slices with lemon juice to prevent browning.
Slice the onions into thin wedges.
Roll out the pastry dough into a 14-inch round. Place it on a parchment-lined baking sheet.
Sprinkle the Gruyere cheese in the center of the dough, leaving a 2½-inch border around the edges.
Arrange the onion and fennel slices on top of the cheese.
Place apple slices on top of the tart.
Brush the apples, fennel, and onions with melted butter.
Scatter the minced rosemary over the top and season generously with salt and pepper.
Place a few fennel fronds on top, reserving the rest for garnish.
Fold the edges of the pastry dough over the filling, pleating as you go. Brush the dough with the egg wash.
Place the tart in the oven and reduce the heat to 375°F. Bake for 45-50 minutes, or until the crust is golden brown.
Remove the tart from the oven and allow it to cool slightly.
Remove the wilted fennel fronds and garnish with fresh ones before serving.
Serve the tart warm or at room temperature.