You are deliberately refusing to acknowledge that this tax only kicks in when profits exceed 25% of costs.
Cost cutting that does not reduce prices, does not increase wages and does not improve product quality but only increases profits beyond a very high level the company is already making does no good for anyone other than enriching an already very rich corporation with more cash in the bank and/or higher distributions. It has no societal benefit.
In your example the cost of a switch from coal to solar would be a deduction from profits and thus would mean that the tax would not kick in.
If the switch saved money, no company deliberately spends more money than it has to. Companies can always use more money for tax deductible purposes like higher quality, higher wages, more distribution, more R&D etc.
Companies will always act to save money if reasonably possible because they have legitimate uses for it. In your example if Google could save money by going from coal to solar of course they would do it in order to have more money to spend on things that benefit their employees and consumers.
The problem is when companies are so driven for additional profits for execs and shareholders that they lower quality and raise prices to get them. Then you get gov’t regulation.