That is right Sometime people forgot Japanese role in Chinese modernization though Japanese thought their assistance is not free or large But they paly important role in technology transfer because in the 60's when China start the modernization of infrastructure. Most of the harbors, railways, airport are built by the Japanese companies. I remembber 16 harbors and 2 electrified trunk line.Power plant etc Latter modern manufacturing move en mass to china again transfer of technology and management.Again, what you are saying certainly has some truth to it. But international relations is never as clear cut and simplistic as you are saying. I have already used the Toshiba CNC sale to the USSR as an example. Remember that happened during the height of the Cold War, back when Japan faces a much more dire and dangerous national security threat (which means that they needed the US back then much more than they do right now, this implies that they were in a much weaker position to object to US demand than right now).
Even today with semiconductor many japanese semiconductor are supplying Huawei and robotic stepper motor from Fuji.
Certainly the government is toeing to US out of obvious reason But there are in Japan who see that their future will hinge on China and they make preparation for that day specially among the industrialist Keidanren.