Warm the olive oil in a pan over medium heat. Add the sliced onions and sauté until softened, lightly caramelized, and fragrant, about 8 minutes. Stir in the chopped garlic, ginger, red pepper flakes, and allspice, ensuring the flavors meld together. Cook for another 2 minutes, stirring frequently.
Incorporate the tomato paste, stirring continuously to evenly distribute it across the pan. Cook until its color deepens from bright red to a rich, burnt orange hue, which should take about 2 minutes.
Pour in the canned whole tomatoes along with their juices, followed by 2 tablespoons of brown sugar, apple cider vinegar, a generous pinch of salt, and a few twists of freshly ground black pepper. Stir well and taste, adjusting the sugar level as needed. Typically, 3 to 4 tablespoons strike the right balance of sweetness.
Bring the mixture to a gentle simmer, then lower the heat slightly. Allow it to cook at a slow simmer, stirring occasionally, until it thickens and takes on a glossy sheen, roughly 20 minutes. Taste again, making any necessary adjustments with additional sugar, salt, or pepper.
Once the ketchup has reached the desired consistency, blend until completely smooth. Let it cool to room temperature before transferring to a jar. Store in the refrigerator for up to one month.