That's not just a Japan problem, but a 'most of the industrialized world' problem: Germany, Italy, France, Canada, etc. They all had wealthy growing industries back in the days when coal, steel and fossil fuel vehicle manufacturing was hot, but failed to create, or invest and expand into the new ones, mainly IT, also known here as 'tech'.
Only the US has managed to avoid this trap "thanks" to its lack of industry unions and social policies, coupled with a free market economy, start-up friendly tax system, and strong VC culture focused on disrupting existing players by throwing big money at new risky ideas.
While the VC investment culture and focus on disrupting existing players is non existent in most other countries, coupled with the stronger social policies and unions, like in Europe for example, means there's a lot of political pressure (and lobbying!) to support the existing big old established players that contribute to the economy and employ tens of thousands of workers, to keep the status quo, no matter how antiquated and stagnating they are, instead of letting the free market run its course and letting them slowly whither die and focus instead on creating new businesses and industries in their place.
This is also compounded in some of the countries I listed above by the ageing demographics who's retirement prospects are tied to the old declining industries(like in Germany), meaning their votes, government policies and financial aid will focus on keeping those old declining industries on life support for as long as possible, instead of focusing on supporting newer industries instead at the expense of the older ones. It's what the people vote for.
Exceptions would be Singapore, Switzerland, and some of the UK-Ireland, Nordic and BeNeLux countries that have a strong education system focused on research and innovation and a business friendly tax and legal system for VC investors and who's population isn't too invested and entrenched in old declining industries.