Sooji halwa is made by roasting semolina in ghee before liquid is added, and the roasting takes longer than every other step combined. It is doing two separate jobs.
Fat coats each grain before water arrives
Semolina is coarse wheat particles full of starch. Dropped straight into hot liquid, the outer starch gelatinizes instantly and glues neighboring grains into lumps.
Roasting first surrounds every particle with fat, which is hydrophobic and slows the water reaching the starch. Hydration then happens gradually and evenly rather than all at once on the outside.
This is why halwa made without adequate roasting is lumpy no matter how vigorously it is stirred once the liquid is in. The problem is created before the stirring starts.
Roasting builds the flavor the dish is named for
Heating dry starch and protein together produces browning reactions that generate nutty, toasted aromatic compounds that raw semolina does not have.
The color change from pale to golden tracks that development directly, which is why the instruction is given as a color rather than a time.
The liquid ratio decides the finished texture
More liquid gives a soft, spoonable halwa; less gives a firm one that can be pressed and cut. The same roasted base supports both, and the ratio is where the decision is made.
Liquid is added hot, because cold liquid hitting hot roasted semolina cools the pan sharply and lets the outside of the grains gel before the heat comes back up.
It also spatters violently, since the fat in the pan is well above the boiling point of water when the liquid goes in.
Sugar goes in at a specific point
Sugar added before the semolina has absorbed its liquid competes for that water and slows hydration, leaving gritty centers in the grains.
Added after absorption, it dissolves into the already-swollen mass and loosens it slightly, which is why a halwa often thins right after the sugar goes in and then firms again.
Ingredients in an American kitchen
The semolina wanted here is the fine to medium grade sold as sooji or rava in Indian grocery stores, which is finer than the coarse semolina sold for pasta in US supermarkets.
Cream of wheat is a close and widely available substitute, since it is the same wheat endosperm milled to a similar size, though it absorbs slightly more liquid.