The problem is: when the filament has stopped moving because of a jam, the print is already compromised. Also unless you have a Bowden feed setup, or mount the filament sensor on your direct drive printhead (undesirable because of added weight, obstruction to access for filament loading, and the extra wires needed to the printhead), the filament motion is not well correlated with extruder stepper movement, due to the printhead motion pulling on the filament above it.
Furthermore, in non-Bowden setups, a filament jam is likely to pull hard enough on the gantry as the head carriage moves to cause the X stepper to loose steps (or Y as well in a CoreXY machine), and before extrusion fails completely, compromise the layer height by deflecting the gantry and head carriage, either or both resulting in a failed print before the lack of extrusion fails it.
To avoid this and pause the print before it fails, you need to detect the jam as it starts to occur. It would be worth investigating a filament tension sensor, consisting of three V grooved ball bearings in the same plane with the filament running over them, two fixed on one side of the filament and one on the other side, between the first two, on a sprung lever arm that operates a microswitch. If the filament tension becomes excessive it will attempt to straighten the filament path through the bearings, deflecting the lever against the (adjustable) spring tension, and operating the microswitch.
You'd probably also want a filament runout sensor to detect filament breaks.