For the corn cakes:
For the relish:
Ranch dressing, for serving (optional)
Cut the corn kernels off of the cobs and place in a large bowl. Place 2 cups of the corn kernels in the food processor and pulse several times, until the corn is slightly pureed but still chunky. Scrape the mixture into the bowl with the remaining corn kernels. Add the flour, cornmeal, onion, basil, baking powder, and baking soda to the bowl. Season with salt and pepper to taste. Stir to mix well. Add the eggs, buttermilk, and butter, and stir just to combine.
To make the salsa, combine all of the ingredients except the avocado in a medium bowl and mix well to combine. Cover and refrigerate until ready to serve, up to 2 days. Just before serving, mix in the avocado.
Place a large skillet over medium heat. Add just enough oil to barely cover the bottom of the pan and heat until sizzling hot. Scoop the batter into the skillet a heaping tablespoon at a time, cooking the cakes in batches of 4 or 5 so that they are not touching. Fry 1-2 minutes per side, until golden brown. Transfer the cooked cakes to a wire rack and repeat with the remaining batter.
Serve immediately topped with the relish and drizzled with ranch dressing, if desired.