Prepare your pie dough for a double crust 9 inch pie, divide into two discs, wrap, and refrigerate for at least 1 hour. If using store-bought dough, let it sit at room temperature for about 10 minutes.
Wash the apricots, slice them in half, remove the pits, and cut each half into 2–3 slices. You should end up with about 6 cups of sliced apricots.
In a large mixing bowl, combine the sliced apricots with granulated sugar, brown sugar, cornstarch, lemon juice, cinnamon, salt, and vanilla. Gently stir to coat evenly. Let sit for 10 minutes to release juices, then stir again.
Preheat the oven to 400°F. On a floured surface, roll one dough disc into a 12-inch circle. Transfer to a 9-inch pie dish, press gently into the bottom and sides, and trim the overhang to 1/2 inch. Refrigerate while you roll the top crust.
Pour the apricot filling into the chilled bottom crust and spread evenly. Scatter the butter pieces over the top of the filling.
Roll the second dough disc into a 12-inch circle. Place it whole over the filling and cut steam vents, or cut into strips for a lattice top. Trim overhang, fold edges under, and crimp to seal.
Brush the top crust with beaten egg and sprinkle with coarse sugar. Place the pie on a baking sheet and bake at 400°F for 20 minutes. Reduce heat to 350°F and bake 35–40 minutes more, until the crust is golden and filling bubbles. Use a crust shield if edges brown too quickly.
Transfer the pie to a wire cooling rack and cool for at least 3 hours before slicing. This allows the filling to set properly. Serve warm or at room temperature.