The emergence of a large-scale stellar bar is one of the most striking features in disc galaxies. By means of state-of-the-art cosmological zoom-in simulations, we study the formation and evolution of bars in Milky Way-like galaxies in a fully cosmological context, including the physics of gas dissipation, star formation and supernova feedback. Our goal is to characterize the actual trigger of the non-axisymmetric perturbation that leads to the strong bar observable in the simulations at z = 0, discriminating between an internal/secular and an external/tidal origin. To this aim, we run a suite of cosmological zoom-in simulations altering the original history of galaxy–satellite interactions at a time when the main galaxy, though already bar-unstable, does not feature any non-axisymmetric structure yet. We find that the main effect of a late minor merger and of a close fly-by is to delay the time of bar formation and those two dynamical events are not directly responsible for the development of the bar and do not alter significantly its global properties (e.g. its final extension). We conclude that, once the disc has grown to a mass large enough to sustain global non-axisymmetric modes, then bar formation is inevitable.