Trim any excess fat or leathery membrane from the lamb. Using the tip of a paring knife, poke 20 small holes over the entire surface of the lamb, then stuff each hole with a piece of the sliced garlic, a 1" piece of rosemary, and a piece of anchovy, leaving the tips of the rosemary sticking out. (Use the paring knife to help tuck the items in, if need be.) Season the lamb all over with salt and 2 tsp. of the espelette pepper. Transfer lamb to a roasting pan, cover loosely with plastic wrap, and refrigerate for 12–36 hours.
Remove lamb from refrigerator 2 hours before you are ready to roast it, to allow it to come to room temperature. Heat oven to 450°. Rub surface of lamb with 1 tbsp. of the oil, then transfer the lamb, meatier side down, to a baking sheet and roast just until it begins to sizzle, 20–25 minutes.
Meanwhile, grease a 13" × 16" roasting pan with 1 tbsp. of the oil; set aside. Heat remaining oil in a large skillet over medium-high heat. Add chopped rosemary, remaining garlic, remaining espelette pepper, fennel, and salt and cook until light golden brown, about 10 minutes. Stir in 1⁄4 cup of the stock and all of the vermouth. Reduce heat to medium and simmer, covered, stirring occasionally, until fennel is tender, 8–10 minutes. Transfer fennel mixture to the reserved roasting pan; spread out evenly. Cover fennel with half of the potatoes. Season with salt and pepper, then scatter the onions over the top. Layer the remaining potatoes over the top of the onions, overlapping them slightly. Pour remaining stock evenly over the top of the vegetables; season with salt and pepper.
Remove lamb from oven; settle it on top of the potato-fennel gratin with the meatier side up. Pour any accumulated pan juices over the lamb and return to the oven. Reduce temperature to 325° and continue roasting the lamb until a meat thermometer inserted in the thickest part of the leg registers 135° for medium-rare, about 1 1⁄4 hours.
Transfer lamb to a large platter, cover loosely with foil and set aside to let rest for 15 minutes. Increase oven temperature to 400°. Return roasting pan to oven and cook until gratin is tender and golden brown, about 15 minutes more. Carve lamb and serve with potato-fennel gratin.