Position an oven rack in the top third of the oven, about 6 inches from the broiler. Turn the broiler to high and let it preheat. Halve and thinly slice the yellow onion. Thinly slice the garlic cloves. Drain both cans of cannellini beans over a colander but do not rinse them. Optional: place 1/2 cup of the drained beans in a small bowl and mash them roughly with a fork into a chunky paste. Measure out the marinara sauce, water, and spices so everything is ready to add.
Heat 2 tablespoons of olive oil in a 12-inch oven-safe skillet over medium-high heat until shimmering. Add the sliced onion and 1/2 teaspoon of kosher salt. Cook, stirring occasionally, for 7 to 9 minutes until the onion is soft and lightly golden at the edges. If the onion sticks, add a small splash of water to loosen it.
Add the sliced garlic cloves and stir them into the onion. Add the 2 tablespoons of tomato paste and cook, stirring, for 2 minutes until it deepens in color and becomes fragrant. Add the 1 teaspoon of dried oregano and 1/2 teaspoon of red pepper flakes. Stir and cook for another 30 seconds.
Pour in the 1 1/2 cups of marinara sauce and 1/4 cup of water. Scrape up any browned bits from the bottom of the pan. Add all of the drained cannellini beans, including the mashed beans if prepared. Stir gently to combine. Season with the 1/4 teaspoon of black pepper and taste for salt. Bring to a gentle simmer and cook for 8 to 10 minutes, stirring occasionally, until the sauce has thickened and the beans are heated through.
If using baby spinach, add it to the skillet in large handfuls, stirring and folding after each addition. Cook for 1 to 2 minutes until the spinach is fully wilted and incorporated into the beans. Distribute the mixture evenly across the pan. Skip this step if not using spinach.
Remove the skillet from the heat. Sprinkle 1 1/2 cups of shredded low-moisture mozzarella evenly over the entire surface, covering edge to edge. Transfer the skillet carefully to the oven under the broiler using oven mitts. Broil for 3 to 6 minutes, watching closely, until the cheese is fully melted, bubbling at the edges, and golden brown in spots. Do not walk away during this step.
Remove the skillet from the oven using oven mitts and place on a heat-proof surface. Immediately sprinkle 1/4 cup of freshly grated Parmesan over the top. Scatter fresh basil leaves across the dish. Drizzle lightly with honey if desired. Let the skillet rest for 3 to 5 minutes before serving. Scoop into bowls and serve with crusty bread or garlic bread.