Oil separating from fried onion/spice mixture, why does it happen?
When you cook a vegetable, such as a cut up onion, it will release water. The water initially will create an emulsion with the oil in the pan, so you won't see them as clearly separated elements, but the water will also be evaporating. When enough (perhaps all) of the water has dissipated, the emulsion breaks and you see the oil separate from the rest of the ingredients.

The breaking of the emulsion doesn't tell you anything in particular about the doneness of the vegetables, nor about the extraction of the spices' oils into your cooking fat, since the time it takes for the water to evaporate will depend on the strength of the burner, the geometry of the pan, and the amount of onion and other vegetable that is present.

If you are always using the same stove, pan, amount and cut of onion, and amount of spices, then you will be able to gauge the readiness of the mixture from cues like the water having evaporated. In general, though, it would be best to evaluate the mixture's flavor by tasting it. In some cases, you may even want to add a little bit of water (or stock) to the pan to let the onions continue to sweat!