Bring a large pot of salted water to a boil. Meanwhile, mince 4 garlic cloves. Cut 1 pound fresh mozzarella cheese into ½-inch cubes (about 3 cups). Finely grate 2 ounces Parmesan cheese (about 1 packed cup), or measure out ⅔ cup store-bought grated. Drain 2 jars marinated artichoke hearts.
Add 1 pound dried short pasta to the boiling water and cook according to package directions for 2 minutes less than al dente, 4 to 5 minutes. Reserve ¼ cup of the pasta water, then drain the pasta. Meanwhile, arrange a rack 6 to 8 inches from the broiler element and heat the broiler to high.
Heat 2 tablespoons olive oil in a large broiler-proof skillet (12-inches or larger) over medium-high heat until shimmering. Add the artichoke hearts in a single layer. Cook, stirring occasionally, until browned in spots, about 5 minutes. Add 10 ounces baby spinach, a few handfuls at a time, and cook until just wilted, 2 to 4 minutes. Add the garlic and ½ teaspoon red pepper flakes and sauté until fragrant, about 30 seconds more. Remove from the heat.
Add the pasta and pasta water, half of the mozzarella, half of the Parmesan, the juice of ½ medium lemon (about 1 ½ tablespoons), 1 teaspoon kosher salt, and ¼ teaspoon black pepper to the skillet. Stir to combine.
Dollop 1 container whole-milk ricotta cheese evenly over the mixture and gently stir the pasta, keeping a few large pockets of ricotta here and there. Spread the mixture into an even layer and sprinkle with the remaining mozzarella and Parmesan cheeses.
Broil until the artichokes are browned slightly and the cheese is melted and browned in spots, 4 to 6 minutes.
