In a large skillet, heat olive oil over medium heat. Add the chopped onion and sauté until translucent, about 5 minutes.
Stir in the minced garlic and chopped spinach, cooking until the spinach has wilted and any excess moisture has evaporated. Remove from heat and let cool for a few minutes.
In a large mixing bowl, combine the sautéed spinach, feta, ricotta, Parmesan, nutmeg, salt, and pepper. Mix well until thoroughly combined.
Preheat your oven to 375°F (190°C).
On a clean, flat surface, lay out one sheet of phyllo dough and brush it lightly with melted butter. Place another phyllo sheet on top and brush it again with butter.
Cut the layered phyllo sheets into long strips, about 3 inches wide.
Place a tablespoon of the spinach mixture at one end of each strip. Fold the side over to form a triangle, covering the filling. Continue folding the triangle shape down the strip (like folding a flag), creating a triangle pocket. Repeat until all filling is used.
Place the formed triangles on a baking sheet lined with parchment paper. Brush the tops with more melted butter and sprinkle with sesame seeds if desired.
Bake in the preheated oven for 25-30 minutes or until golden brown and crispy.
Remove from the oven and allow to cool slightly before serving.