under what conditions would an officer be compelled to sit in the car on a traffic stop?
Maybe if there was an adverse climate condition (i.e. torrential rain, snow etc). So, why not call for another officer to cover you?
If you absoulutely had to do a stop by yourself, and had to stay in the car, keep your head up while writing the citation, and place your tag book at eye level. don’t wear a wide brim hat. if you had to look up, your vision would be obscured. At least you might catch a sudden movement if the violator was going to charge at you.