Line a plate with paper towels. Heat 1/2 inch of extra virgin olive oil in a saucepan over high heat until it starts to sizzle. Deep-fry the eggplant cubes in a single layer for 3 to 4 minutes, until they are golden brown. You may need to fry the eggplant in batches. With a slotted spoon, remove the cubes to the plate to remove the excess oil.
In a large skillet, heat the olive oil over medium heat. Add the onion and cook it for 2 minutes, until they become soft.
Add the celery and cook it for 2 minutes, unti it softens.
Pour the tomato paste mixture into the skillet, mix everything, and stir it for 30 seconds to combine.
Add the cherry tomatoes, green olives, and capers. Cook the mixture for 5 minutes, or until the tomatoes start to soften . If the vegetables become too dry, add up to ¼ cup of water.
Finally, turn the heat to high, stir in the fried eggplant, capers, basil, sugar, vinegar and pine nuts. Toss the mixture for a few seconds until the liquid is absorbed. Season the mixture to taste with the salt and crushed red pepper flakes, if using.
Serve the caponata hot or at room temperature.