Add the flour, salt, and granulated sugar to a large mixing bowl. Whisk until combined.
Add the cold cubed butter. Use a pastry cutter or your fingertips to work the butter into the flour until the mixture resembles coarse crumbs, with a few pea-sized pieces of butter remaining.
Add the ice water one tablespoon at a time. Mix gently until the dough begins to come together. Do not overmix.
Divide the dough into two equal portions and shape each portion into a disk. Wrap the disks and refrigerate for at least 30 minutes.
Place the sliced apples in a large bowl. Add the granulated sugar, brown sugar, flour or cornstarch, cinnamon, nutmeg, lemon juice, vanilla extract, and salt.
Toss gently until the apples are evenly coated. Let the filling rest for 10–15 minutes.
Preheat the oven to 425°F (220°C).
Roll out one chilled dough disk on a lightly floured surface into a circle slightly larger than a 9-inch pie dish.
Transfer the dough to the pie dish and gently press it into the bottom and sides. Trim any excess dough around the edges.
Add the apple filling to the crust and spread it evenly. Dot the surface with a little extra butter if desired.
Roll out the second dough disk and place it over the apple filling. Trim the edges, then press and crimp the top and bottom crusts together.
Cut several vents in the top crust to allow steam to escape. Alternatively, create a lattice crust.
Whisk the egg with one tablespoon of water. Brush the egg wash over the top crust and sprinkle with coarse sugar, if desired.
Refrigerate the assembled pie for 15 minutes before baking.
Place the pie on a baking sheet and bake at 425°F (220°C) for 15 minutes.
Reduce the oven temperature to 375°F (190°C) and continue baking for 35–45 minutes, or until the crust is golden brown and the apple filling is bubbling.
Cover the crust edges loosely with aluminum foil if they begin to brown too quickly.
Transfer the pie to a cooling rack and allow it to cool for at least 2–3 hours before slicing.
Serve the apple pie warm with vanilla ice cream, whipped cream, or caramel sauce.