Context. Very high-energy (VHE, E > 100 GeV) observations of the blazar Mrk 501 with MAGIC in 2014 provided evidence for an unusual narrow spectral feature at about 3 TeV during an extreme X-ray flaring activity. The one-zone synchrotron-self Compton scenario, widely used in blazar broadband spectral modeling, fails to explain the narrow TeV component. Aims. Motivated by this rare observation, we propose an alternative model for the production of narrow features in the VHE spectra of flaring blazars. These spectral features may result from the decay of neutral pions (π0 bumps) that are in turn produced via interactions of protons (of tens of TeV energy) with energetic photons, whose density increases during hard X-ray flares. Methods. We explored the conditions needed for the emergence of narrow π0 bumps in VHE blazar spectra during X-ray flares reaching synchrotron energies ∼100 keV using time-dependent radiative transfer calculations. We focused on high-synchrotron peaked (HSP) blazars, which comprise the majority of VHE-detected extragalactic sources. Results. We find that synchrotron-dominated flares with peak energies ≳100 keV can be ideal periods for the search of π0 bumps in the VHE spectra of HSP blazars. The flaring region is optically thin to photopion production, its energy content is dominated by the relativistic proton population, and the inferred jet power is highly super-Eddington. Application of the model to the spectral energy distribution of Mrk 501 on MJD 56857.98 shows that the VHE spectrum of the flare is described well by the sum of a synchrotron self-Compton (SSC) component and a distinct π0 bump centered at 3 TeV. Spectral fitting of simulated SSC+π0 spectra for the Cherenkov Telescope Array (CTA) show that a π0 bump could be detected at a 5σ significance level with a 30-min exposure. Conclusions. A harder VHE γ-ray spectrum than the usual SSC prediction or, more occasionally, a distinct narrow bump at VHE energies during hard X-ray flares, can be suggestive of a relativistic hadronic component in blazar jets that otherwise would remain hidden. The production of narrow features or spectral hardenings due to π0 decay in the VHE spectra of blazars is testable with the advent of CTA.