Preheat and prep the crust: Heat the oven to 375°F (190°C).
Fit the pie crust into a 9-inch pie dish. Dock the bottom with a fork. Line with parchment and fill with pie weights or dried beans.
Blind bake for 15 minutes, remove weights and parchment, and bake 5–8 minutes more until lightly golden. Let cool slightly.
Slice and salt the tomatoes: Core and slice tomatoes about 1/4-inch thick. Lay them on a rack or layered paper towels.
Sprinkle both sides with salt and let them sit for 20–30 minutes to release moisture. Pat dry well.
Mix the topping: In a bowl, combine cheddar, mozzarella, and mayonnaise. Add black pepper to taste.
Stir in garlic if using.
Season the base: If using, brush the crust with a thin film of olive oil. Scatter the sliced onion over the bottom of the crust. Sprinkle with half the chopped basil.
Layer the tomatoes: Arrange a snug layer of tomatoes over the onions.
Grind over pepper and, if desired, a few drops of vinegar or lemon juice. Repeat with a second layer. Use the prettiest slices on top.
Add the topping: Spread the cheese-mayo mixture evenly over the tomatoes, going edge to edge to seal in juices.
Bake: Bake at 375°F for 30–35 minutes, until the top is deeply golden and bubbling and the crust is crisp.
Rest and garnish: Let the pie cool at least 20 minutes to set.
Sprinkle with remaining basil before slicing.
Serve: Enjoy warm or at room temperature. A simple green salad or grilled corn makes a perfect partner.