'D' shafts are not appropriate for plastic gears because the sharp edges cut into the gear hole and chew it out or break the gear apart, whereas a round shaft with slightly larger diameter will fit tightly and not damage it (provided a good quality plastic is used).
'D' shafts are used on 1/10th scale '540' size R/C car motors, combined with a steel or aluminium pinion gear and grubscrew. This is required due to the high torque load which is too much for a plastic gear, and greater convenience when separating them compared to a pressed on metal gear (which needs a gear puller to remove).
They are also commonly used in small appliances such as hand drills and electric screwdrivers, often coupled to a molded metal pinion with matching flat. In this case the pinion is simply slipped on and held in place by the gearbox, so is easier to assemble. The down side is that a larger 'flat' is required to avoid chewing out the gear hole, which weakens the shaft. This technique is also sometimes used in devices such as hair dryers and vaccuum cleaners which have a plastic impeller, with a metal clamping ring added around the outside to make a stronger connection and prevent the plastic from splitting.
Another downside of the 'D' shape is that the coupling may not be perfectly concentric. For applications that need good balance, such as model airplane propellers, a Collet adapter is often preferred. This clamps tightly around around the shaft while ensuring that the output shaft is precisely centered.

In reality small electric motors are almost always manufactured with round shafts, then ground down when necessary to produce the 'D' shape. Motors sold for general purpose use don't have a flat because the customer might not want it, and they can always grind or file a flat into the shaft if they need it.