In a large skillet over medium heat, melt the butter. Add the onions to the butter and cook until softened, about 8-10 minutes. Add the garlic and zucchini. Season with salt and pepper. Continue cooking until the zucchini is somewhat soft (but not too soft!), about 8 minutes. Turn off the heat.
While the zucchini is cooking, bring a large pot of water to boil, once boiling add about 1 tablespoon of salt to the water. Cook the pasta until a tad under al dente. Drain the pasta, but reserve 1 1/2 cups of the pasta water.
Add the pasta to the zucchini mixture. Stir to combine.
Add ¾ cups of the reserved pasta water, ricotta, red pepper flakes, parmesan, pesto, and lemon. Turn heat to low and cook and stir until the pasta turns creamy, about 1-2 minutes. Taste and adjust seasonings. If you need to add more pasta water to the dish, do so. Serve immediately.