Preheat the oven (with one of its racks positioned in the lower third) to 400°F.
15 minutes before you plan to roll out the pie dough, remove it from the refrigerator and allow it to soften slightly. Lightly flour a clean work surface and a rolling pin and roll one of the pieces out to an even, ¼-inch thick circle, then carefully lift the dough into a 9-inch aluminum or glass pie plate. Use a sharp knife to trim the edges, leaving 1 inch of overhang all the way around. Set the shell aside while you make the filling.
To a large bowl, add the flour, sugar, cinnamon, nutmeg, and salt and stir to combine. Add the blueberries and vanilla and toss well to coat, then transfer the filling to the reserved pie shell, mounding the berries slightly in the center. Dot with the butter and set the pie aside while you roll the top crust.
Once again, lightly flour your work surface and rolling pin. Roll the second piece of dough out to an even, ¼-inch thick circle, then carefully lift the dough over the pie. Use a sharp knife to trim the edges, leaving about 1½ inches of overhang all the way around, then tuck the edges of the top crust under the edges of the bottom crust. Pinch the edges together decoratively to seal, or crimp them all the way around with the tines of a fork. Use the tip of a paring knife to make 6–8 slits on the surface of the crust to vent. Transfer the pie to the freezer just until the crust is firm, about 15 minutes.
In a small bowl, beat together the egg yolk and milk. Brush the surface of the chilled pie crust with the egg wash and sprinkle with coarse sanding sugar, if desired. Place the pie on a large, rimmed baking sheet, transfer it to the oven, and bake until the crust is set and just beginning to brown, 20–25 minutes. Drop the temperature to 350°F and continue cooking until the crust is evenly golden brown and the juices are bubbling and thickened, 30–40 more minutes for fresh berries or 60–70 minutes for frozen. (If the edges begin to darken before the filling has thickened, cover them with strips of aluminum foil to finish baking.) Cool to room temperature before cutting into wedges and serving.