Heat the oil in a large heavy pan over medium heat. Finely chop the onion, add to the pan and season with salt. Do the same with the celery and carrot and cook with the onion until they're softened, 8 to 10 minutes, stirring often to ensure it doesn't stick.
Once the veggies have softened slightly and the onion has turned translucent, grate in the garlic. Stir for a minute until fragrant and then add in the beef. Using a wooden spoon, breakdown the beef so it's in small pieces and continue to stir until all the meat has browned, about 10 minutes. At this point, stir in the tomato paste and then the red wine, stirring until all absorbed. Top with the beef stock and bring to a boil. Turn down the heat to a simmer, add in the thyme, bay leaves and season with a good pinch of salt and pepper. Leave to cook until you have a rich thick sticky sauce and most of the liquid has gone, 15 to 20 minutes. Remove from the heat.
Peel and dice the potatoes. Add to a large pot of salted boiling water and boil until fork tender, about 25 minutes. Drain completely. Mash the potatoes with a potato masher, leaving a bit of purple chunks for texture. Add in the butter and the milk to loosen and season with salt and pepper.
Now all your elements are ready for building your rainbow cottage pie. Spoon a thick layer of the beef in a 9- by 13-inch glass baking dish, pressing down to pack it in. Cut the cherry tomatoes in half across the equator and lay them cut-side down over the beef, making sure there are no gaps. Completely cover the tomatoes with the spinach, pushing down gently to flatten and tucking into the corners. Sprinkle the cheese on top of the spinach (this will go gorgeously gooey in the oven). Spoon the mashed potatoes on top in 4 equal dots and then smooth over to cover the whole of the top, making sure no spinach is on show. Use the back of a spoon to add a bit of texture (like frosting a cake) to the mash so it crisps in the oven.
Bake until crisp and bubbling and the tomatoes are juicy, 30 to 35 minutes. Leave to sit for 10 minutes - if you can - before serving.