Bring a large pot of water to a boil. Season the water with 1-2 teaspoons of salt. Cook the pasta according to package directions. Drain, reserving ½ cup of the pasta water.
Meanwhile, add the butter to a skillet set over medium heat.
Add the shallot and cook until soft and translucent, about 5-6 minutes. Season with a pinch or two of pepper. Add the flour and stir to incorporate. Cook for 1-2 minutes to get rid of the raw flour taste.
Add the milk, stirring to incorporate. Cook for 2-4 minutes until slightly thickened. Add the cheese and stir until melted. Fold in the tortellini.
Add the ham and peas. Stir in pasta water to thin out the sauce as needed. Season to taste with salt and pepper. Serve immediately.
Cook the pasta in well-salted water. This is the only way to infuse the pasta itself with flavor. For 10 ounces of pasta, add about 2 teaspoons of salt to the boiling water.
Reserve some pasta water to thin out the cheese sauce as necessary.
Use freshly grated cheese. It melts better and creates a smoother sauce.
Wait to season with salt until the end. Both the ham and cheese contain salt, so salting the individual layers will likely lead to an over-salted dish.