Put 3 tablespoons olive oil and the remaining 1/2 teaspoon chili flakes into the skillet over medium heat. Add the onions, remaining garlic, and 1/3 of the basil leaves and cook until the onions start to soften, about 5 minutes. Put in the eggplant and cook until it is soft, about 10 minutes, adding more olive oil if necessary. Add the zucchini, fresh tomatoes, and capers; season with salt and pepper. Continue cooking until these vegetables are soft but still whole. Add the canned tomatoes, vinegar, and remaining basil leaves. Continue to cook for another 15 minutes; remove from the heat and set aside to cool.
To serve, put the ratatouille into a bowl or platter and top with the feta, olive, and almond mixture.