Heat 2 tablespoons of extra-virgin olive oil in a skillet over medium-low heat. Add the finely minced onion and cook, stirring occasionally, until translucent, about 4–5 minutes.
Add the canned whole plum tomatoes with their juice to the skillet and gently break them up with a wooden spoon. Season with 5–6 of the basil leaves and salt and pepper to taste.
Cover the skillet and simmer the sauce on low for 15 minutes, stirring occasionally, until it is creamy but still slightly chunky.
Meanwhile, bring a large pot of lightly salted water to a boil. Add the mafaldine pasta and cook according to package directions until al dente; for firmer pasta, drain 2–3 minutes before the package time. Reserve 2 tablespoons of the pasta cooking water, then drain the pasta.
Remove the tomato sauce from the heat and stir in the remaining basil leaves. Drain any excess liquid from the ricotta and add the ricotta to the sauce with 2 tablespoons of the reserved pasta water; stir until combined and smooth. Taste and adjust seasoning with salt and pepper.
Fold the cooked mafaldine into the sauce until evenly coated. Drizzle with a little extra-virgin olive oil if desired and serve immediately.