Preheat the oven to 375°F (190°C).
Cook pasta in salted boiling water until just al dente according to package instructions, then drain and set aside.
In a large skillet, melt 2 tablespoons of butter over medium heat.
Add the chopped onion and carrots and sauté until the onion is translucent and carrots have softened, about 7 minutes.
Add the minced garlic and cook for another 1-2 minutes until fragrant.
Stir in the chopped tomatoes and cook until they start to break down, about 5 minutes.
Sprinkle the flour over the vegetables and stir well to create a roux, cooking for 1-2 minutes.
Slowly add about 1 cup of water (or pasta cooking water) while stirring to make a thick sauce; simmer gently until slightly thickened.
In a small bowl, beat the eggs and then slowly temper them by mixing in a few spoonfuls of the warm sauce to avoid curdling.
Combine the tempered eggs into the sauce and stir quickly until the sauce thickens further, then remove from heat.
Mix the cooked pasta into the sauce evenly, coating all the pieces.
Transfer the pasta mixture into a buttered baking dish, dot with the remaining 1 tablespoon of butter, and bake uncovered for 15–20 minutes until golden and bubbling.
Let cool for a few minutes before serving to let the flavors meld together.