A rat race is ... a simple game of "follow the leader" in fighter planes. The leader does everything he can think of — Immelmanns, loops, snap rolls, and turns, always turns, tighter and tighter. [Popular Science, May 1941]
In the 1930s actual rat races of some sort are frequently mentioned among popular carnival and gambling attractions. Meaning "fiercely competitive struggle," especially to maintain one's position in work or life is by 1939. Rat-run is from 1870 in the sense of "maze-like passages by which rats move about their territory," but originally and usually in a derogatory transferred sense.
[Matthew] Milton was not, at the period we write of [c. 1811], at all in the ring ; for in the following March he was steward of a rat-race, held at a public-house in Shepherd's-market, where four of these "varmin," decorated with different coloured ribands, were started for a sweepstakes, round the clubroom, before a host of sportsmen. ["Sporting Incidents at Home and Abroad," The Sporting Review, May 1848]