Cook the pasta to al dente, drain and set aside in a large bowl.
Into a large pot, over medium heat, add the olive oil and butter. Add the garlic and shallot and sauté until softened.
Whisk in the flour until smooth. Add in the milk slowly, continuously whisking to combine. Once all the milk is in and the sauce is smooth, allow to simmer until slightly thickened, stirring occasionally to prevent burning.
Remove the pot from the heat and stir in the pesto and pecorino romano. Season with salt and pepper.
Pour the sauce over top the cooked pasta. Stir in the shredded mozzarella and ricotta.
Add the pasta to a large baking dish and sprinkle with a little more pecorino. Bake for approx 20-30 minutes until bubbly and browned on top.