We analyse the output of the hi-res cosmological "zoom-in" hydrodynamical simulation ErisBH to study self-consistently the formation of a strong stellar bar in a Milky Way-type galaxy and its effect on the galactic structure as well as on the central gas distribution and star formation. The simulation includes radiative cooling, star formation, SN feedback and a central massive black hole wich is undergoing gas accretion and is heating the surroundings via thermal AGN feedback. A large central region in the ErisBH disk becomes bar-unstable after z ∼ 1.4, but a clear bar-like structure starts to grow significantly only after z ≃ 0.4, possibly triggered by the interaction with a massive satellite. At z ≃ 0.1 the bar stabilizes and reaches its maximum radial extent of l ≈ 2.2 kpc. As the bar grows, it becomes prone to buckling instability, which we quantify based on the anisotropy of the stellar velocity dispersion. The actual buckling event is observable at z ≃ 0.1, resulting in the formation of a boxy-peanut bulge clearly discernible in the edge-on view of the galaxy at z = 0. The bar in ErisBH does not dissolve during the formation of the bulge but it is long-lived and is strongly non-axisymmetric down to the resolution limit of ∼ 100 pc at z = 0. During its early growth, the bar exerts a strong torque on the gas within its extent and drives gas inflows that enhance the nuclear star formation on sub-kpc scales. Later on, as the bar reaches its maximum length and strength, the infalling gas is nearly all consumed into stars and, to a lesser extent, accreted onto the central black hole, leaving behind a gasdepleted region within the central ∼ 2 kpc. Observations would more likely identify a prominent, large-scale bar at the stage when the galactic central region has already been quenched. Bar-driven quenching may play an important role in disk-dominated galaxies at all redshift. AGN feedback is instrumental in this scenario not because it directly leads to quenching, but because it promotes a strong bar by maintaining a flat rotation curve, suppressing the density of baryons within the central kpc in the early stages of the formation of the galaxy.