This seems calculated on Putin’s part: he doesn’t want his Chinese partner to drift toward America.
Notably, there is a lot of history here. In 1972, US President Richard Nixon visited China, a major symbol of the US making inroads as Beijing pursued policies different from Moscow's.
A lot has changed since Nixon went to China. China did appear to be closer to the US orbit for decades, but that began to change in the late 1990s and early 2000s. Russia also underwent changes: the collapse of the Soviet Union led Moscow to shift policies in the 1990s, but it shifted back towards greater hostility to the US in the 2010s.
Putin seeks to keep China close after Trump visit
The last few decades have seen increasingly negative relations between the US, China, and Russia. China is concerned that this could lead to an inevitable clash. For Moscow, the clash is already happening in Ukraine.

