For modern Japan,US loss in Taiwan scenario means:
(1)complete collapse of their current security model (~70 years of comfortable existence + 1980s sacrifices for naught).
(2)complete reversal of last 150(!) years, when Japan was either east Asian dominant, or dominant representative of "pax Americana" in the East.
With this in mind, expecting Japan not to participate in Taiwan scenario is arguably more optimistic than expecting US to stand aside and watch.
It isn't like Australia which simply forgot that they themselves may actually suffer the consequences of their actions (incomprehensible!) - Japan in this case is caught by its throat.
I see the collapse of Japan's current security model as inevitable, given Chinese growth.
---
If you look at the numbers, Japan doubling military spending to 2% of GDP means an increase from $50 to $100 billion by 2027
But remember that China adds a Japan-sized economy roughly every 4 years, whilst the Japanese economy is stagnant. SIPRI also estimate that China only spends 1.7% of GDP of the military, which is lower than the 2% target set by Japan and indeed, the NATO minimum.
So China has ample scope to increase military spending.
In 10 year's time, I expect the Japan to face a military balance similar to what Taiwan faces today.
China will enough high-end ballistic/hypersonic missiles to shut down Japanese airfields, which then allows lower cost munitions to be delivered by plane or launched from trucks. And like Taiwan, Japan is essentially a small but densely populated island with no natural resources and which is far from friendly support or resupply, but comparatively very close to China.
Yes, Japan could develop a counter-strike capability, but this wouldn't change the end-result in a China-US/Japan war.
Yes, Japan building a counter-strike capability will factor into Chinese calculations, but it isn't something China can't handle. In any case, China is perfectly fine with a neutral Japan. So once China builds up its forces, it will be up to Japan to declare national suicide by joining the US and declaring war, instead of staying neutral.
---
On the economic front, Japan's industries are facing greater competition from China and elsewhere, and are de-industrialising anyway.
The example of the Japanese automobile industry is instructive.
There is no scenario where Japan's automakers successfully transition and maintain electric vehicle production if Japan goes to war with China.
1. If the Japanese automakers decouple and don't embrace the Chinese EV supply chain, their sales will likely shrink in half as they've really fallen behind Tesla and the Chinese automakers in electric vehicle technology. Half of Japan's car production is exported abroad and therefore cannot hide behind Japanese protectionism
2. If Japanese automakers successfully make the transition to EVs by embracing the Chinese supply chain, all those gains will be lost if Japan goes to war with China.
Note that the auto industry is the bedrock of the Japanese economy and tax base, which will have to fund any arms buildup against China.
So in 10 years time, in the event of a China-Taiwan war, I do expect Japan to stand aside and remain neutral