Origin of Abelian gauge symmetries in heterotic/F-theory duality