Prior to WW1 (in Europe anyway), there was a distinct class-based disconnect on the impact of technology on society. Yes, the upper/political classes knew that it meant many more people had moved to the cities, and many industrialists were becoming rich.
But it was the impact of technology on warfare that forced the political classes to consider idea that technology leadership was a matter of national existence.
At the same time, the industrial scale of the war, and the huge number of people who lost their life led to wide-spread questioning of the political classes by the working class, which in turn led to an interest in the things that did affect them so much during the war: technology.
In the case of the opium wars, the "lesson" learnt was the same lesson as during the subjection of India and other European colonies, ie: the cultural superiority of the white man.
Obviously is retrospect this was the wrong lesson, but that's what people thought at the time.