Would Japan form a third faction during the cold war or would it ally with Western or Eastern blocs
It will be its own faction in the Cold War. It will at least have trade interests globally.
It will have less universalist appeal than either the USSR and USA, but could market itself successfully at least to those people not directly under its own boots.
Japan with China would be too loathsome, too competitive with Anglo-American interests, and too much of a vital foil for the naval lobbies in both the US and UK to be accommodated within the western bloc, despite any common feelings of anticommunism.
Stalin did not invite people into the eastern bloc except on his terms.
Japan would want to have a distinctive global brand.
It would be a true strategic triangle, even with Japan definitely the 3rd wheel. At times there would be shifts of tactical diplomatic and strategic emphasis that would make it look like any of the combinations below:
West plus Soviets Cold War against Japan - (the first two liking to make trouble for Japan in China and make consolidation more difficult)
West Cold War against Soviets and against Japan (post Cold War USA shows that the US is totally capable of choosing to be confrontational with multiple independent adversaries) - The US and USSR support proxies against each other, and the US and Japan supporting proxies against each other, with the Soviets and Japanese maintaining prudent defenses against each other but having a neutrality pact and not emphasizing confrontation against each other.
West and Japan Cold War against Soviets -
Say the Soviets get bogged down in a conflict in Afghanistan, the Middle East or Africa - Both the west and Japan could enjoy making things difficult for the USSR, back mujhadeen, etc.
Shorter answer: "yes"