In each of Walter Mitty's daydreams he imagines himself to be heroic. That seems to be the common denominator throughout the tale. James Thurber suffered from feelings of inferiority all his life because he was handicapped by very bad eyesight. In one of his memoirs he tells about how he was consistently rejected by the draft board during World War I because of his vision, which grew much worse with age until he was completely blind. Being a humorist. (His rejection for military service probably accounts for his inclusion in the story of the episode about Mitty being an heroic flying ace. No doubt Thurber was using his own fantasies in his story about Walter Mitty.)
Thurber wrote about his feelings with humor, but he himself said that humor was based on the recollection of past suffering. Walter Mitty has daydreams of heroism and superior competence just because his creator had feelings of inferiority and incompetence. Mitty's wife, though not present in the story, figures prominently. James Thurber was heavily dependent on his wife becaue of his visual handicap.