Checking for jams is difficult as it is, I have a handful of ideas how to try and do that. I want to reiterate this is all experimental work and might not appear in the final design.
This is a traditional idea of using an optical limit switch with a perforated wheel and contact gear to measure filament movement directly above the drive gears. I am a bit stumped on how to neatly cram the entire system into the machine because it is great that it all fits but it is another thing to put it together for the final product.
I sure hope Marlin has code included for this, otherwise this will be a short lived experiment.