Adding a little pasta water to your sauce is the best way to make it stick to every bite of delicious pasta, but you don't have to limit this trick to marinara. Next time you want pesto pasta, use some of that starchy pasta water. Image from Vicky Wasik.
While this trick offers a similar effect, you need to apply it differently with pesto than red sauce. Instead of adding the water to the sauce, then letting it meld on the stove before tossing in the pasta, you should mix the pesto with the pasta in a bowl first, off the heat of the stove. Then slowly mix in the pasta water bit by bit.
Daniel Gritzer of Serious Eats explains this way the high heat from mixing the water and pesto together on a burner won't reduce the fresh flavour of the herbs that you want to preserve. The end result is a delicious pesto sauce that doesn't clump up or collect at the bottom of the dish.
The Right Way(s) to Serve Pesto on Pasta [Serious Eats]