A large proportion of the traditional repertoire predates the invention of the pub, and a lot of it was created fairly recently in places where ther has never been one (like the more remote Scottish islands). So we can discount the pub singalong as a significant factor.