A possibility of formation of a Bose-Einstein condensed phase of pions in the early Universe at nonvanishing values of lepton flavor asymmetries is investigated. The evolution of cosmic trajectories during the QCD epoch is evaluated at various empirically allowed electron, muon, and tau lepton asymmetries. Calculations are done in the framework of a hadron resonance gas model with pion interactions matched to the first-principle lattice QCD equation of state at nonzero isospin density. The cosmic trajectory passes through the pion condensed phase if the combined electron and muon asymmetry is sufficiently large. The pion condensed phase is shown to leave an imprint both on the spectrum of primordial gravitational waves and on the mass distribution of primordial black holes at the QCD scale.