Preheat the oven to 350 degrees F. Heat the oil in a large Dutch oven over high heat.
Season the shanks on both sides with salt and pepper, place in the pan and cook until golden brown on both sides, about 4 minutes per side.
Remove the shanks to a plate. Remove fat from the pan. Add the pancetta to the pan and cook until golden brown. Remove pancetta with a slotted spoon to a plate lined with paper towels.
Add the onion, carrots, celery and garlic to the pan and cook until soft and lightly golden brown, 4 to 5 minutes.
Add the red wine, scrape the bottom of the pan and cook until completely reduced. Add the beef stock, diced tomatoes, thyme, rosemary and parsley and bring to a simmer. Add the shanks and 1/3 of the pancetta back to the pan, cover and transfer to the oven. Cook until the meat is tender and falling off the bone, about 2 hours.
Remove the shanks to a cutting board and when cool enough to handle, shred the meat into bite-size pieces and place in a bowl.
Strain the cooking liquid into a bowl. Place 3 cups of the cooking liquid into a large high-sided saute pan and bring to a boil over high heat. Cook until the liquid is reduced to about 3/4 cup. Add the shredded meat and the remaining cooked pancetta to the pan along with 1 cup of the tomato sauce, parsley and basil and stir to combine and just heat through.
Stir together the ricotta, eggs, parsley, basil, cheese and salt and pepper in a bowl. Cover and refrigerate for at least 1 hour to allow flavors to meld.
Heat the oil in a large saute pan over medium-high heat, add the onions and cook until soft, 3 to 4 minutes. Add the garlic and red chili flakes and cook for 1 minute. Add the tomatoes, bring to boil, season with salt and pepper and cook until the sauce is reduced and thickened, about 25 to 30 minutes. Stir in the parsley and basil.
Melt the butter in a medium saucepan over medium heat. Whisk in the flour and let cook for about 2 minutes. Slowly whisk in 2 cups of the hot milk and continue whisking until the sauce is thickened and loses its raw flavor, about 5 to 7 minutes. Season the sauce with nutmeg, salt and pepper and whisk in the cheeses. If the sauce is too thick, whisk in some of the remaining milk.
Preheat the oven to 375 degrees F.
Butter the bottom and sides of a 9 by 13-inch baking dish with the butter. Ladle a thin layer of bechamel evenly over the bottom of the pan. Place a layer of pasta dough, cut to fit the inside of the pan on top of the bechamel and top the pasta with the ricotta mixture and spread evenly. Spread a thin layer of bechamel over the ricotta, sprinkle with a few tablespoons of Parmesan and some basil leaves. Top with another layer of pasta and spread the meat mixture evenly over the top. Ladle an even layer of bechamel over the Bolognese mixture, sprinkle with a few tablespoons of Parmesan and some basil leaves. Place the final layer of pasta dough over the meat mixture and ladle the bechamel over the top to completely cover the pasta and sprinkle with 3 tablespoons of Parmesan.
Place the pan on a baking sheet and cover loosely with aluminum foil. Bake for 20 minutes. Reduce the heat to 350 degrees F, remove the foil and continue baking until the top is golden brown and the filling is bubbling, about 25 to 35 minutes longer. Remove from the oven and let rest 10 minutes before cutting. Cut into slices and top with some of the tomato sauce, more grated cheese and chopped parsley and basil.