Ragtime has the baseball song that kind of comes out of nowhere
Not so, IMO - it's perfectly rooted in the story. The world is changing, and Father doesn't see it, or doesn't want to see it. It hits him first with "New Music," and then later with "What A Game," where he laments that the peaceful pastime of his youth isn't what it was. Little Boy, of course, is having none of that, joining right in with the disruptive fans. It's a welcome comic number in the middle of a bleak story, but it also drives home (sorry) an important point about a world that is changing too fast for Father and his generation.