Muons and taus are leptons. The muon's (radioactive) lifetime is about 2.2 microseconds, and the tau about 0.29 picoseconds. Pion and kaons are mesons. The pion and charged kaon lifetime is ~ 25 and 12 nanoseconds. All are created by very energetic collisions with protons. They do not reside in the protons. Eventually they all decay to electrons (or positrons) and anti-neutrinos (and neutrinos).
Protons are uud (up up down) quarks in Fig. 13.2 (a). Mesons (with quark composition) are shown in Table 13.2. The production of mesons and leptons depends on available energy (in the center of mass), conservation of charge, baryon number, lepton number, CPT (charge, parity, time) etc. The probability of any particular final state depends on branching ratios and probability of individual decays.