Cook 4 ounces diced pancetta in a large 12-inch high-sided skillet over medium-low heat, stirring occasionally, until browned and crisp, 7 to 12 minutes. Using a slotted spoon, transfer to a plate and reserve the skillet and pancetta fat.
Meanwhile, cook the spaghetti and prepare the zucchini. Bring a large pot of salted water to a boil over medium-high heat. Add 1 pound dried spaghetti and cook according to the package directions until al dente, 8 to 12 minutes. Reserve 1 cup of the pasta water, then drain the spaghetti.
Grate 1 ½ pounds zucchini on the largest holes of a box grater (about 5 cups). Place the zucchini on a clean kitchen towel. Gather up the sides and squeeze over the sink to press out as much moisture from the zucchini as possible.
Add 2 tablespoons olive oil to the reserved skillet and heat over medium heat until shimmering. Add the zucchini, ¾ teaspoon of the kosher salt, and ¼ teaspoon black pepper. Cook, stirring regularly and scraping the bottom of the pan to prevent sticking, until the liquid that releases has been cooked off and the zucchini is softened and almost jammy, 10 to 12 minutes.
Return the pancetta to the skillet. Add the spaghetti and toss well to coat the pasta. Remove the skillet from the heat.
Whisk 4 room-temperature large egg yolks and 2 room-temperature large eggs together in a medium bowl. Whisk in 1 ½ ounces finely grated Pecorino Romano cheese and the remaining ½ teaspoon kosher salt. While whisking constantly, slowly stream in 2 tablespoons of the pasta water until well-combined.
While tossing the pasta constantly with tongs, slowly start pouring the egg mixture into the skillet, pouring over the noodles and not the edges of the pan. Add ¼ cup of the pasta water, return the pan to the lowest heat, and continue to cook, tossing constantly, until the sauce starts to thicken and coats the pasta, about 1 minute. (Add more pasta water a tablespoon at a time as needed for a thinner sauce.)
Remove the skillet from the heat. Stir in ¼ cup chopped fresh basil leaves. Taste and season with more kosher salt as needed. Serve immediately with more grated Pecorino, chopped fresh basil leaves, finely grated lemon zest, and red pepper flakes if desired.
