Preheat the oven to 180C/160C Fan/Gas 4 (320F US).
Begin by heating 2 tbsp (about 29 ml) of the butter and 1 tbsp olive oil in a large frying pan.
Once melted, add the onions and herbs, cooking them gently until the onions turn soft and begin to brown. Remove the rosemary and thyme sprigs.
Melt the rest of the butter by heating it in a small saucepan.
Using approximately one-fourth of the sliced potatoes, create a layer at the base of a shallow ovenproof dish (1.5 liters/2½ pints), overlapping the slices. Brush this layer with melted butter and season it with salt and pepper.
Spread one-third of the onion mixture evenly over the potatoes, reaching the edges of the dish. Repeat the sequence: layer the buttered potatoes, onions, and seasoning, making the final layer with potatoes.
Tuck the bay leaves beneath the top section of the potatoes and slowly pour the stock over the entire layer. Let it seep through the layers of potato and onion and down to the bottom.
Bake the Welsh Onion Cake for 1–1¼ hours until the potatoes are tender and golden brown on top.