Motion of the sun as observed from mercury
Both effects combined.

Day being longer than year would just have retrograde motion of the Sun on sky, but no direction change.

Variation of the distance alone happens on Earth, and we have no such effect.

But the combination of both factors, in the precise amount they have on Mercury, makes this effect happen.