In a large deep skillet, heat the olive oil over medium-high heat. Season the chicken thighs with salt and pepper, then cook until crisp and golden on the first side, about 4–5 minutes. Turn the thighs over and cook until browned on the second side, about 3–4 minutes more. The chicken does not need to be cooked through — it will finish cooking during the braise.
Remove the chicken from the pan and add the butter. Add the onions and cook until translucent. Add in the garlic, ginger, cinnamon, cumin, salt and pepper and cook for 2 minutes. Add the chicken back to the pan and add in the chicken stock. Bring to a boil, then turn down to low and cover the pan. Simmer, covered, until the chicken is very tender and shreds easily, about 20–25 minutes. Remove the chicken from the pan and shred it with two forks into bite-sized pieces.
Meanwhile, increase the heat to medium and reduce the braising liquid by half, about 8–10 minutes. Return the shredded chicken to the pan, then reduce heat to low. Slowly pour in the beaten eggs while stirring constantly with a wooden spoon. Cook gently, stirring, until the eggs form soft, loose curds that bind with the chicken — about 3–4 minutes. Stir in the toasted chopped almonds and parsley. Remove from heat and let cool for 10 minutes.
Meanwhile, preheat your oven to 350°F / 175°C (180°C fan-forced). Brush a 9-inch round cake pan with melted butter. Layer 5 sheets of phyllo dough into the pan, brushing each sheet with butter and letting the edges overhang the sides. Spoon the cooled filling into the pan and spread evenly. Top with the remaining phyllo dough, brushing each with butter. Fold the overhanging edges inward to seal the pie, then brush the top with the remaining melted butter. Bake until the phyllo is deeply golden and crisp, about 25–30 minutes.
Remove the pastilla from the oven and let it rest in the pan for 5 minutes. Carefully invert onto a serving plate or serve directly from the pan. Dust generously with powdered sugar through a fine-mesh sieve.