Heat the oven to 400°F (200°C). Lightly grease a 9-by-13-inch baking dish or a similar 3-quart casserole dish.
Place the potatoes in a large pot, cover with cold water by about 1 inch, and add a generous pinch of salt. Bring to a boil, then simmer until the potatoes are very tender when pierced with a fork, about 15 minutes. Drain well and return the potatoes to the warm pot.
Add the butter, warm milk, 1 teaspoon salt, and pepper to the potatoes. Mash until smooth and creamy. Stir in the cheddar, if using. Cover to keep warm.
Meanwhile, heat the olive oil in a large skillet over medium-high heat. Add the ground beef and cook, breaking it up with a spoon, until browned and no longer pink, about 6 to 8 minutes. Carefully drain off excess fat if needed.
Add the onion and carrots to the skillet. Cook until the vegetables begin to soften, about 5 minutes. Stir in the garlic and cook for 30 seconds.
Sprinkle the flour over the beef mixture and stir for 1 minute. Add the tomato paste, Worcestershire sauce, thyme, beef broth, salt, and pepper. Stir well, scraping up any browned bits from the pan.
Bring the filling to a gentle simmer and cook until the gravy thickens slightly, about 4 to 5 minutes. Stir in the frozen peas, then taste and adjust the seasoning if needed.
Transfer the beef filling to the prepared baking dish. Spoon the mashed potatoes evenly over the top, spreading them to the edges so the filling is covered. Use a fork to make shallow ridges across the potato topping.
Bake until the filling is bubbling around the edges and the potato ridges are lightly golden, about 20 to 25 minutes. Let the cottage pie stand for 10 minutes before serving so the filling can settle.