01 - Preheat the oven to 350°F.
02 - Toss beef cubes with flour, salt, and pepper to evenly coat.
03 - Heat vegetable oil in a large heavy-based pan over medium-high heat and brown the beef in batches. Remove and set aside.
04 - In the same pan, add onion, garlic, carrots, and celery and sauté until softened, about 5 minutes.
05 - Add mushrooms and continue cooking for 3 minutes.
06 - Stir in tomato paste and cook for 1 minute to develop flavor.
07 - Return beef to the pan and add beef stock, red wine if using, Worcestershire sauce, thyme, and bay leaf. Bring mixture to a simmer.
08 - Cover and cook on low heat for 1.5 hours, stirring occasionally, until beef is tender and sauce has thickened. Remove bay leaf and allow filling to cool to room temperature.
09 - Roll out two-thirds of the pastry and line a 9-inch pie dish, trimming the edges.
10 - Spoon the cooled beef mixture evenly into the pastry shell.
11 - Roll out remaining pastry and cover the pie, sealing and trimming excess pastry. Cut a small vent on top.
12 - Brush the surface of the pastry with beaten egg to achieve a golden finish.
13 - Bake in the preheated oven for 40 to 45 minutes until the pastry is crisp and golden brown.
14 - Allow the pie to rest for 10 minutes before slicing and serving.