Both today's "For Me and My Gal" and "Yankee Doodle Dandy" rev up the patriotic fervor by referencing World War I, which was still fresh in people's minds in the 1940's. Instead of the world-weary post-war feeling of "Remember My Forgotten Man," there was a rosy glow around the memory of The Great War at a time when America was entering WW2.
"Yankee Doodle Dandy" sets its patriotic stage through the use of the American flag. It makes no difference that the movie is in black and white; the colors red, white and blue come through clearly throughout the movie. The flag in FDR's office in the beginning and the multiple flags in the 4th of July Parade of Georgie's birth create a cord that binds through time. The 2nd World War is not a major character in the movie, but its presence certainly stands over the whole movie.
One thing stuck out in the dialogue with FDR. It's the line about his admiration for the Irish immigrants, who wear their (our) love of country on our sleeves. As a time when many Irish looked upon the War in Europe as England's War and not their problem, this simple statement is a kind of gentle reminder that this current conflict was about the USA---their home.
Opening with FDR in the Oval Office brought an immediacy to the movie that would hit 1940's audiences quickly and emotionally. Beginning with the flashback of George's birth sets up the film as just another biography. The scene with FDR sets up the movie as a love story between George M. Cohan and his country.
One more note: "Yankee Doodle Dandy" was shown all the time on Million Dollar Movie when I was a kid in NY. It was incredibly popular among us kids. World War II was still a recent memory. I remember the film creating the same kind of patriotic fervor among my friends that it must have in its original run.