But the real power that the wattmeter measures is V×I×cos(ϕ)
Not true.
If you were measuring DC power you could take an instantaneous measurement of voltage and current and get power. You could do this several times in succession to get a better average (should the load and hence current be cyclic).
The wattmeter performs "multiplication" (and averaging) in the magnetic fields and the inertia of the mechanics. It doesn't measure RMS values and compute power factor - it just multiplies and averages (and of course this type of wattmeter works on DC)
Where is power factor involved here? It isn't because if the DC voltage is stable and the current is a sinusoidal waveform impressed on a dc level there is no phase relationship at all between volts and amps.
So, if the voltage and current are sinusoidal, does the wattmeter magically take power factor into account? No it doesn't - it continues to do the math and multiply amps by volts.
Power factor is a convenient way of describing the phase angle between voltage and current in an ac circuit. It's an OK method when loads are simple but when loads are more complex and the current waveform is no-longer sinusoidal, power factor is much harder to determine.
And how does the old analogue wattmeter cope with harmonic distortions on the current waveform? It does just fine because power is volts x amps averaged - the harmonics in the current waveform (which make a nonsence of \$V.I. cos(\phi)\$) are just ignored because when Sin(A) is mulitplied by Sin(B) the average level is zero.
This is why the electrickery supply companies don't like harmonic distortions - it's current that they have to supply that doesn't contribute to power used just like when standard loads have a small power factor - harmonics have a "zero power factor" in effect..