When you run a company as large and old as Toyota, you always hedge your bets. There are some other options to battery-powered electric vehicles (hydrogen IC). They are currently not as mature but anyone running something as big as Toyota needs to hedge against that sort of outlier tech. If Toyota abandoned IC, got rid of its IC production lines, they would suffer hugely if hydrogen IC one out as the green tech. All the major car companies do such things. That's why they have survived as long as they have.
Would Tesla survive if a new hydrogen storage killed the market for battery-powered cars? Toyota has seen and survived a few such revolutions.