The origin and evolution of magnetic fields in the Universe is still an open question. Their observations in galaxies suggest strong magnetic fields already at high redshift as well as at present time. However, neither primordial magnetic fields nor battery processes can account for such high field strengths, which implies the presence of a dynamo process with rapid growth rates in high-redshift galaxies and subsequent maintenance against decay. We investigate the particular role played by feedback mechanisms in creating strong fluid turbulence, allowing for a magnetic dynamo to emerge. Performing magnetohydrodynamic simulations of isolated cooling gas haloes, we compare the magnetic field evolution for various initial field topologies and various stellar feedback mechanisms. We find that feedback can indeed drive strong gas turbulence and dynamo action. We see typical properties of Kolmogorov turbulence with a k-5/3 kinetic energy spectrum, as well as a small-scale dynamo, with a k3/2 magnetic energy spectrum predicted by Kazantsev dynamo theory. We also investigate simulations with a final quiescent phase. As turbulence decreases, the galactic fountain settles into a thin, rotationally supported disc. The magnetic field develops a large-scale well-ordered structure with even symmetry, which is in good agreement with magnetic field observations of nearby spirals. Our findings suggest that weak initial seed fields were first amplified by a small-scale dynamo during a violent feedback-dominated early phase in the galaxy formation history, followed by a more quiescent evolution, where the fields have slowly decayed or were maintained via large-scale dynamo action.