Boil the potatoes in a pot of salted water until tender, about 15 minutes. Drain and mash with milk, butter, salt, and pepper. Set aside.
Preheat oven to 400°F.
In a large skillet, heat olive oil over medium heat. Add onion and garlic, sauté until soft, about 5 minutes.
Add carrots and celery to the skillet, cook until slightly softened, about 5 minutes.
Stir in tomato paste and flour, cook for 2 minutes.
Gradually add vegetable broth, thyme, and rosemary. Bring to a simmer and cook until slightly thickened, about 5 minutes.
Add peas and cook for an additional 2 minutes.
Transfer the vegetable mixture to a baking dish. Spread the mashed potatoes over the top.
Bake in the preheated oven until the potatoes are golden, about 20 minutes.