Very good question..
Actually there is another difference between "Der Zug" and "Die Bahn" besides the gender of the words!
When you say "Der Zug" then you most likely mean taking the difference between 2 cities for example from Hannover to Hamburg. You won't use "die Bahn" hier! Eventhough is not completely wrong.
When we use "Die Bahn" we could mean sometimes the intercity differences also for example in Hannover from A to B. For example :" Ich bin heute in Hannover und nehme die Bahn zum Shopping Center um meinen Dermatologist zu sehen."
You shouldn't use the Zug here because its about taking a Dictance in Hannover from my Location to next location in shopping center.
I hope I could make it a little clearer.