Grease a 14 x 4.75 inch (36 x 12 centimeter) rectangular tart pan or 9 inch (23 centimeter) round tart pan with removable base with butter.
Remove the chilled dough from the refrigerator and roll on a floured surface into a thin sheet large enough to completely cover the bottom and sides of the pan, about 1/8 inch (3 millimeters) thick.
Carefully transfer the sheet to the prepared pan, gently pressing down along the bottom and sides to make sure it is completely covered without any air bubbles. Cut away any excess scraps.
Prick across the bottom of the tart with a fork, then place the pan in the refrigerator to chill while the oven preheats.
Preheat oven to 400˚F (200˚C).
Once preheated, remove the pan from the refrigerator and place on a rimmed baking sheet (to protect the oven just in case any butter seeps through the bottom or anything bubbles over).
Cover the crust lightly with a sheet of parchment and fill with ceramic pie weights or uncooked rice. Bake in the preheated oven until starting to set, 10-15 minutes.
Carefully remove the parchment sheet with the weights from the crust and allow the crust to cool slightly.
In a small bowl, toss the shredded cheese with the flour until evenly coated.
Sprinkle the coated cheese across the bottom of the partially baked crust.
Cover the cheese with an even layer of the caramelized onions.
In a medium bowl, whisk together the eggs, heavy cream, salt, pepper, and nutmeg until evenly blended.
Pour the mixture into the tart pan in an even layer over the caramelized onions.
Arrange the thin apple slices slightly overlapping across the top of the tart.
Gently brush the top of the apple slices with melted butter and, if desired, sprinkle with coarse sugar.
Bake in the 400˚F (200˚C) oven until the egg mixture is puffed and the apple slices are lightly golden, about 25-30 minutes.
Allow the ingredients to settle in the tart for 5 minutes before carefully removing from the pan.
Serve warm or at room temperature.