How do songs like Yankee Doodle operate as community building artefacts?

How do songs like Yankee Doodle operate as community building artefacts?