As other posters have noted - the tune was likely composed by Luther - disputed for some time, but generally accepted today. The form,
A A B + half of A,
is typical of a traditional hymn in "bar form", which has nothing whatever to do with beer halls. No it is possible that Luther was inspired by a song he heard -- no one makes a melody that is "completely original", so I don't totally discount your thesis.
With all due respect, the "Battle Hymn" and it's troubling theology hardly makes it a standard of Christian hymnody. Quite the opposite - very few places, evangelical or mainline, even sing it anymore. And for good reason.
Also, "Be Thou My Vision" is set to a traditional Irish melody, which I'm not sure could by any stretch call it a "pagan" melody. Again, there are many different veins of folk music, most of which do not have any profane connotations.