China's calculus changes if they have to strike Japanese and Philippine sovereign territory (even if it's hosting US forces) in order to accomplish their goals.
And it's unclear if even Xi is willing to send as many ships and bodies as it would take to the bottom of Taiwanese straits to get an invasion force across. (Which then faces a guerrilla insurgency in mountainous terrain)
If Xi sees Taiwan as a gateway to Pacific hegemony, maybe that math is worth it...
But asking a populace to support that in the face of economic weakness and high youth unemployment is a tall order. The COVID lockdown riots demonstrated that even China's social control is a fine line.
China doesn't have the natural resource base within its borders (they're digging up their iron ore reserves faster than any country, and they have to import oil) that Russia does.
Consequently, economic sanctions slow their economy down a lot faster than Russia's.
War may be an internal unifier... but unemployment, poverty, and scarcity is a rapid internal disintegrator.
Looking at "disintegrated" Cuba...
For reference, when Germany and Japan was expanding, they had great, young demographics, and thus very good tax base. Japan had very low debt in 1920 when they started the wars https://www.rieti.go.jp/en/columns/s15_0004.html. Germany had suspended the gold standard and financed the war by borrowing, something China cannot do today.
Another way to think about this is, instead of all the possible money China made that it could have spent on war, instead it decided to build half-finished tofu dreg buildings, then the CCP elites took those dirty money out of China and into western economies :). Even the elites knew China was no match for the combined wealth/forces of western countries.
Perun covers the topic of Chinese military readiness with excellent sourcing and great detail, as always:
For example, usually the party provincial secretary (most powerful man in that province) concurrently serves as the first secretary of the provincial military region party committee, but he doesn't have real power in the military. When war comes, it's the group of people who are more experienced with military (the generals) going to make the call, and everyone else is not going to be happy.
Think Politburo and the Central Military Commission. When war comes it's the CMC who is going to make the call. Some people take seats in both but some not. They all stand in the Central Committee of the Chinese Communist Party -- but power distribution is going to shift when things move.
That's why I think the biggest resistance comes from the party itself, not depression. Depression, historically, usually leads to wars, not from them.
I agree that Xi probably wants some legacy coined to him, but he is only 70 and looks pretty healthy (as far as I see) so I guess he can still wait it out.
I still don't believe there is going to be an invasion of Taiwan happening in the next few years, but if it does, I think it's going to be a lot bigger than just Taiwan. From this perspective, it is scary.