Why do (or did, until very recently) aircraft transponders wait to be interrogated before broadcasting beacon signals?
The Secondary Surveillance Radar system provides range in a method similar to primary radar: by measuring the time between the transmission of the interrogation signal and reception of the reply. The range is proportional to the time difference, minus a constant that allows for the aircraft transponder to perform processing.

This would not work if transponders replied without a interrogation.

Azimuth is traditionally found by observing the direction of the SSR antenna the moment this occurs, though some modern systems utilize the time delay between multiple receiver locations (multilateration).