Even if they managed to recover all chip factories after a full scale invasion (which the Taiwanese could easily sabotage), the production is based on a lot of western technology, which they couldn't replicate for decades. So the factories would be of little use.
Chinas economy is also very reliant on exports to western countries (US, Japan, Europe), if they invaded Taiwan that would plunge the world economy into the worst crisis ever seen that would hit China especially hard. They're already struggling with serious demographic and other economic issues that will put them into a difficult spot in the next decades. Invading Taiwan would be very, very terrible for basically everyone, and suicide for the CCP.