This can be caused by the engine misfiring at the wrong point in the sequence. So instead of the plug sparking and the mixture exploding as the mixture is compressed and the piston is about to change direction, ignition occurs prematurely, and the piston gets pushed back "the other way." So this turns the engine the wrong way and pulls the cord back.
Misfiring can be caused by a loose or incorrectly adjusted magnet coil, or a flywheel in the wrong position on the crankshaft due to a damaged flywheel key. Also, poor fuel and air leaks between carburetor and engine can be an issue.