How is it possible that emitting electrons create alternating charges in the cavities of a magnetron?
There's an I. I. Rabi story here.   During WWII, when the UK shipped their entire radar project to the USA (in order to avoid 1940 bombing, during Battle of Britain,) the prototypes and documents arrived a week before the inventors did.

The physicists at MIT's new "Radiation Lab[1]" got a head start at analyzing the weird inventions: cavity Klystron and Magnetron tubes. After much hemming and hawing, finally I. I. Rabi announced, “Oh, it's very simple; it's just a kind of a whistle." And E.U. Condon replied, "Okay, Rabi, how does a whistle work?" Rabi couldn't explain.

That's the central concept:  blow a stream of air across the orifice of a flute or whistle (or an empty beer-bottle.) Then, the nonlinear switching of the air-stream will inject pulses into the hollow cavity, which leads to feedback amplification, and the hollow cavity provides a high-Q resonator.  Any tiny bit of noise will start the process of oscillation.  The oscillations build up until limited by clipping (or perhaps limited by having net sound-wattage become equal to the wattage of the air-pump power supply.)

The same concept applies to electron-wind in a vacuum chamber.   Direct a stream of electrons across the open end of a resonant waveguide section.  The tiniest bit of thermal noise will cause the stream to slightly divert, which injects a tiny wave into the resonant waveguide.  The wave bounces within the waveguide, causing the electron-stream to periodically divert, which injects a larger wave, and so the feedback-oscillations grow.  It's exactly "a whistle," but with electromagnetic lips blowing an electron-beam across the open end of a metal organ-pipe in a vacuum chamber.

That explains the Klystron.   The Magnetron is just four such whistles arranged in a circle (or six, or eight,) with the net output power being  multiplied by the same number.   In that case, if one of them should momentarily stop oscillating, its neighbors do not.  And, if the output-leakage of the system leads to low Q-factor in one resonator, the other resonators won't stop oscillating, while still dumping their energy into the damped one.    (Imagine a small tornado, powered by an air-pump, and with the mouths of several beer bottles projecting into the circle of wind.  Bore a hole in one of the bottles, and hundreds of watts of sound will escape.)

I don't think the typical "cavities" are actually cavities in the waveguide-sense.  They more resemble one-turn inductors, with a gap in series, providing a relatively large capacitor.  If a very narrow gap is used, then the diameter of the inductor-ring can be made much smaller, yet the frequency stay the same.

Another story: when Raytheon corp. was ramping up their Magnetron radar-tube production, each cavity assembly was hand-made one at a time, from a copper block on a milling machine.  A self-taught technician named Percy Spencer made a suggestion which increased their production by a factor of several hundred:  stamp out the pattern in solder-coated copper sheets, then stack the sheets and braze them together in an oven.  Spencer was eventually promoted to division head, and went on to invent the microwave oven.  (Heh, did he ever go back to get his engineering degree?)



[1] The false label of the MIT secret radar project was Radiation Laboratory, or "Rad Lab," as if they were working on boring useless non-warfare topics, such as atom-splitting and uranium physics!  No enemy spies would even be curious, eh?