Melt half of the butter in a large pan and gently cook the sliced onion until soft and translucent. Add the spinach and cook until just wilted, then remove from the heat. Sprinkle in freshly grated nutmeg and allow the mixture to cool slightly.
In a bowl, combine the beaten eggs, crumbled feta, toasted pine nuts, and basil pesto. Add the cooled spinach mixture and stir well until everything is evenly mixed. Season lightly, keeping in mind that feta already adds saltiness.
Butter the baking tin generously. Layer half of the filo sheets into the tin, brushing each layer with melted butter and letting the edges overhang. Spread the filling evenly over the pastry base.
Fold the overhanging filo over the filling, then loosely scrunch the remaining sheets on top for a rustic look. Brush with remaining butter and bake until golden, crisp, and cooked through.