Measuring phase difference between digital signals
Interesting problem. I suggest a ramp and hold solution. Searching around I found a solution in the LM3900 Norton amplifier datasheet. I have never used these and so can't comment on the likelihood of success.

Figure 85 from the datasheet (page 39).

10.7.2 A LOW DRIFT RAMP AND HOLD CIRCUIT
The input current reduction technique of the previous section allows a relatively simple ramp and hold circuit to be
built which can be ramped up or down or allowed to remain
at any desired output DC level in a 'hold' mode. This is
shown in
Figure 85
. If both inputs are at 0 V
DC
the circuit is
in a hold mode. Raising either input will cause the DC output
voltage to ramp either up or down depending on which one
goes positive. The slope is a function of the magnitude of
the input voltage and additional inputs can be placed in parallel, if desired, to increase the input control variables.




simulate this circuit &ndash; Schematic created using CircuitLab
Figure 1. Suggested glue logic between the A and B phases of the encoder and the ramp and hold.
Differences in phase should show up as differences in height of the plateaus on the OUT waveform.