The way to do that would be to adapt something like the Pat9125 from Prusa. The code already exists, and you don't need an encoder wheel. Just place a bearing against the filament and read the bearing directly (Don't try and read the filament directly though, that doesn't work well).

E.g.: https://www.prusaprinters.org/prints...t-mk3-filament

I thought about doing that again, but I don't get jams in the nozzle often enough to care. Not too sure what Marlin's support for the Pat9125 is either.

The issue with these is generally the detection length. The few millimeters required to detect the stoppage is also often enough to cause problems, especially when separated by a decent length bowden/filament feed tube.