Make the crust: In a large bowl, whisk together flour, salt, and sugar. Cut in cold butter with a pastry cutter (or pulse in a food processor) until the mixture resembles coarse crumbs. Gradually add ice water, 1 tablespoon at a time, mixing until the dough just comes together. Divide into two discs, wrap in plastic, and refrigerate for at least 1 hour.
Prepare the apples: In a large mixing bowl, combine sliced apples with sugars, flour, lemon juice, cinnamon, nutmeg, salt, and vanilla. Toss well until apples are evenly coated. Let sit 10 minutes so the juices begin to release.
Roll out the crust: On a lightly floured surface, roll out one disc of dough into a 12-inch circle. Carefully transfer to a 9-inch pie dish, pressing gently into the bottom and sides. Trim excess dough to hang about 1 inch over the edge.
Assemble the pie: Pour apple filling into the crust. Dot the top with butter pieces. Roll out the second dough disc and place over the apples. Trim excess, then fold edges under and crimp. Cut a few slits in the top crust for steam to escape.
Finish and bake: Brush the top with egg wash and sprinkle with coarse sugar if desired. Place pie on a baking sheet to catch drips. Bake at 400°F (200°C) for 20 minutes, then reduce temperature to 375°F (190°C) and bake another 35–40 minutes, until crust is golden and filling is bubbling.
Cool and serve: Let pie cool for at least 2 hours before slicing. The filling will set as it rests.