EGR valve failure can cause this when it sticks in recirculation mode.
A knowledgeable Ford dealer tech (yes, astonishingly they do exist) says that if the valve sticks open then you may be OK for a bit, but when the engine is asked for a lot of power (e.g. motorway incline or when towing), the temperature of the exhaust gas being recirculated goes up. To avoid damaging the engine when this high temperature occurse, the engine management closes it down to basically idle. You might be able to get 10mph in 3rd gear at this speed.
Turning it on & off clears the fault temporarily, but it may recur as the symptom is the EGR valve getting clagged up, and is particularly a problem for earlier C-Max diesel. Any experienced dealer should be aware of this as ford put out a spate of service messages about this issue.
If it is the EGR valve (diagnostic should tell), and recurs after replacement, then the valve has not been properly programmed/calibrated by the repairer in software