Grease a 24 springform pan with the margarine and then line it with baking paper.
Cap the brown onions at both ends, peel and slice into thin rings. Heat the oil in a pan, add the bacon cubes and roast until they are fragrant. Strain the bacon cubes and set aside. Return the oil to the pan and heat it up. Add the onion rings and toast them until translucent. Put together with the roasted bacon cubes in a larger bowl.
Wash a carrot, cap both ends, peel and julienne threads. Weigh the appropriate amount and add to the bacon cubes. Wash a red pepper, cut in half lengthways, core and cut across into thin threads. Cut the garlic cloves at both ends and press them into the bacon cubes. Wash the fresh celery leaves, chop them roughly and add to the bacon cubes. Add the remaining ingredients, mix well and season to taste.
Melt the margarine in a double boiler and put it in a mixing bowl along with the sugar. Beat the mixture with a mixer and whisk for 10 minutes until the sugar is largely dissolved.
Break open the 3 eggs, separate egg white and yolk. First add an egg yolk to the margarine-sugar mixture and homogenize for one minute at high speed. Repeat the process until all the egg yolks have been processed.
Swap the whisk for a dough hook, mix the flour and spices together. Weigh the baking powder and have it ready. Preheat the oven to 180 degrees.
Stir the flour mixture into the egg-margarine-sugar mixture, tablespoon at a time. Repeat the process until the flour mixture is used up. Finally add the baking powder. Mix everything homogeneously. The dough should be dimensionally stable and not melt. If necessary add a little flour.
Roll out the dough to approx. 30 cm on a floured work surface. Place in the prepared form and pull up the edge approx. 3cm.
For blind baking, cover the dough with baking paper and fill it with a filling material (dried peas, rice, etc.).
Pre-bake the dough in the oven at 180 degrees for 20 minutes on the middle rack. Allow to cool, remove the filling material and the baking paper for blind baking. If the bottom looks very pale, bake it briefly at 200 degrees top heat.
Put the finished onion mixture into the cake and smooth it out. Finally, pour the remaining dough over it and distribute it evenly. Put the pan in the oven on the middle rail. After 10 minutes, reduce the heat to 170 degrees and bake the cake in another 40 minutes. Take out of the oven, let cool down well lukewarm, open the springform pan and remove the baking paper.
Place the onion cake on a serving plate and divide into 12 servings. Enjoy warm. A medium-dry rosé wine or a fruity white wine goes well with it.