Was the development of unions a necessary step in the evolution of classical liberal ideas?
I'm hesitant to say that anything was a necessary step in the evolution of anything. That implies a rather strict determinism of historical progression where it's impossible to skip steps or take alternative paths.
There is a strong causal link between classical liberalism and labor unions, however. Classical liberalism was associated with a general trend toward more free markets and globalized capitalism. The upside of this trend was a dramatic improvement in standard of living. The downside was a tremendous increase in power for a handful of individuals who controlled large businesses.
Labor unions formed out of this combination: People now had a standard of living high enough that they could afford to take some risks to combat injustice (as opposed to living barely at subsistence and using all their energy simply to survive); and they saw that the fruits of free market efficiency were not being shared equitably with the workers who helped produce them. Labor unions gave people more bargaining power together than they'd had alone, and as a result led to a much more equal share of incomes than had existed previously. (Or since---now that labor unions are declining, income inequality is rapidly increasing.)
In addition, many of the ideas of classical liberalism were applied to justify labor unions: The concept of personal liberty, previously understood to mean only "negative liberty" from interference, became conceived as "positive liberty" to participate in society as an equal. Equal opportunity was emphasized, and to justify reforms, many workers pointed out that the system of inherited wealth undermined equality of opportunity. Labor unions were even thought of in many cases as free market institutions---the right of individuals to work together and make contracts freely.