The PWM signal isn’t related to the tachometer signal in phase or frequency. There will be a rough correlation between PWM duty cycle and RPM (and thus, tach output) but the relationship isn’t linear, and is influenced by the fan’s airflow environment. That makes a direct comparison infeasible; some kind of signal processing and analysis would need to be applied to achieve a meaningful result.
Sidebar: about PWM fans. The PWM chop can vary widely in frequency, but note that the recommended spec for PC 4-wire fans is 25KHz. The tach signal on the other hand is two pulses per rev, so you’d have 60Hz with the fan running 1800 RPM. Huge difference.
You could use a microcontroller that has a map of PWM duty vs. RPM to compare. Typical fan data sheets have this information, and you can confirm by measurement. This is well within the capabilities of an 8-pin ATTiny for example, which would provide an I2C port in the bargain.
You can also simplify the problem somewhat and simply check if there is tach output if PWM is over 25% (fans have a minimum PWM duty cycle at start-up before they begin to spin.) Generally this is good enough to detect a failing fan. If you’re trying to detect, say, a clogged filter, that’s more of a software thing.
At any rate I’ve used a Silego Greenpak to manage fans like this (make a PWM, and check the tach for rotation for a system that didn’t have its own PWM generator). I also combined an NTC sensor with the fan control and implemented forced+latched shutdown on overtemp. All in a chip that costs 12 cents in volume. But again, a micro is probably more straightforward for most people.
You can buy commercial fan control ICs from various vendors, most of which are microprocessor-based.