In a large skillet, melt butter over medium-low heat. Add the leeks and onions and cook, stirring occasionally, until soft (810 minutes). Remove from heat and set the mixture aside to cool slightly (about 10 minutes).
Whisk together egg, cream, nutmeg, salt, and pepper in a bowl. Once the onion mixture is cool, add to egg mixture. Divide broccoli rabe and, if using, pancetta among shells. Fill each shell about 3/4 full with custard mixture. Bake until the custard sets (1015 minutes). Serve warm or at room temperature.