Position a rack in the center of the oven and heat the oven to 425°F. In a 12-inch skillet, heat 1 Tbs. of the oil with the butter over medium heat. Add the anchovies, pepper flakes, and fennel seeds and cook, stirring, until fragrant and the anchovies begin to break down, about 30 seconds. Add the onions and a generous pinch of salt and cook, stirring occasionally, until they begin to caramelize, 15 to 18 minutes. Transfer to a bowl, let them cool slightly, and then gently stir in the parsley and 1/2 Tbs. of the thyme. Season to taste with salt and pepper.
In a small food processor, pulse 3/4 cup of the olives, the garlic, lemon juice, zest, and the remaining 1 Tbs. oil and 1/2 Tbs. thyme into a coarse paste. Set the tapenade aside.
On a lightly floured surface, roll the puff pastry into a 9x12-inch rectangle. Transfer to a rimmed baking sheet lined with parchment. Dock the pastry by pricking it all over with a fork, leaving a 1-inch border along the edges. Spread the olive tapenade evenly on the pastry within the border. Top with the onions, dollops of the ricotta, and the remaining 1/4 cup olives.
In a small bowl, beat the egg with 1/2 tsp. water. Brush the pastry border with the egg wash and bake the tart until the pastry is puffed, deep golden-brown on the edges, and light golden-brown on the bottom, 20 to 25 minutes. Let cool briefly and serve warm.