Prep the zucchini: Lay zucchini planks on a sheet pan and sprinkle both sides with kosher salt. Let sit 15–20 minutes to draw out water.
Pat very dry with paper towels.
Preheat the oven: Set to 400°F (200°C). Lightly oil a 9x13-inch baking dish.
Season the tomatoes: In a bowl, toss tomatoes with 1 tablespoon olive oil, garlic, black pepper, and red pepper flakes if using. If your tomatoes are very juicy, pat them once with a paper towel.
Build the first layer: Arrange a snug layer of zucchini in the baking dish.
Drizzle with a little olive oil. Add half the tomatoes, half the mozzarella, and a sprinkle of Parmesan. Scatter some basil.
Repeat: Add another layer of zucchini, remaining tomatoes, mozzarella, and most of the Parmesan (reserve a tablespoon or two for topping).
If using pesto, dot small spoonfuls across this layer.
Finish and bake: Top with the last bit of Parmesan. Bake uncovered for 18–22 minutes, until the cheese is melted and bubbling and the zucchini is tender but not mushy.
Broil for color: Switch to broil for 1–2 minutes to lightly brown the top. Watch closely to avoid burning.
Rest and drizzle: Let the bake rest 5–10 minutes to set.
Drizzle with balsamic (or reduction) and a touch of olive oil. Finish with fresh basil.
Serve: Slice into squares and serve warm. Pair with a side salad or grilled protein for a fuller meal.