Put the chicken and onion in a pot with 1 teaspoon of the salt, the turmeric and water to cover. Simmer for 20 minutes until cooked through, then cool and shred the chicken.
Microwave or steam the cauliflower rice for 5 minutes until just tender. Cool, then squeeze it very dry in a clean kitchen towel. This step is essential for a firm cake.
Heat the oven to 400°F. Whisk the yogurt, eggs, almond flour, saffron water, remaining salt, pepper and 2 tablespoons of the melted butter in a large bowl until smooth and golden. Fold in the cauliflower rice.
Brush a 9-inch round glass or nonstick baking dish generously with 2 tablespoons of the remaining butter. Spread half the cauliflower mixture over the bottom and press it firmly with a spatula.
Scatter the shredded chicken over it, then cover with the rest of the cauliflower mixture and press down well. Cover with foil.
Bake for 30 minutes, uncover and bake for 25 to 30 minutes more, until the bottom and edges are deep golden (check through a glass dish) and the center is set. Rest for 10 minutes.
Run a knife around the edge, place a platter on top and carefully flip the tahchin out. Sizzle the barberries for a minute in the last tablespoon of butter, then scatter them and the pistachios over the top. Cut into wedges.