When did this become a trope in Chinese popular culture? When did it appear and dominate Western understandings of China? Would the first readers of The Romance of the Three Kingdoms, for example, have thought that the warriors were using the martial arts that people might associate with them today?
I can't speak for the history of Kung Fu but you mention Romance of the Three Kingdoms. The novel was (very loosely) based on an era over a thousand years before it was written and building on other works and plays that had come on before, adapting to their tales to its telling of the entire era.
The novel's version of three kingdoms warfare was a mixture of technology that hadn't been invented yet like the Guandao, strategies that would have been too complex for an army of the time to pull off and a fascination with duels to emphasise the skills of its warriors. Usually via mounted combat but sometimes involving archery (usually via faking a retreat then shooting the pursuer) or the odd one on foot, war by duelling was long out of date before the three kingdoms and was very rare in the historical period but it worked for historical fiction. On very rare occasions mastery of weather (and thus the heavens), insulting someone to death, and ghosts come into the novel battles.
I can't say I'm aware of any preceding play or story about the three kingdoms that involved kungfu (though there certainly could have been) and nothing in the novel strikes me as going for that style. It was using a perception of the past that already existed and that was mounted warriors with spears and sometimes unusual weapons, often fighting in front of their armies.
Nowadays what we consider the ye olde past has changed, the media upon which we get our historical fiction (instead of mouth and written word, we have screens) and so what works for selling an exciting story adapts to use those visual options.