I personally underestimated the level of xenophobia in Japan until very recently. When Shinzo Abe alluded to opening up certain segments of the economy to migrant workers, such as allowing in caretakers in nursing homes, janitors, etc., the backlash within Japan was quite enormous. I heard it constantly on TV and read about it continuously on the internet; it was a entirely unimaginable notion to the average Japanese xenophobe (I won't guess at what percentage of the population they represent).
Abe recognizes this is a necessity given the fact that Japan's public debt is at about 240% of GDP and is rising rapidly (expected to possibly reach 400% of GDP in the next 10 years) while the population is expected to crater toward the 50 million mark by the end of this century. Japanese leaders know privately they are going to have to open the country up to much higher levels of immigration -- nothing like in the West, but still much higher than in the past -- and some have talked about trying to stabilize the population at 100 million. If that's the case, they will have to allow in several hundred thousand immigrants per year.
I don't believe that automation is really going to lend itself to large-scale depopulation, either. Automation has been going on for a long time now, and it doesn't play out quite the way people expect. It leads to strange imbalances where programmers can get $110,000 offers out of school and other college grads are lucky to make $30,000. It creates shortages in the workforce that can restrict growth on a national scale; Japan is known already to be facing critical labor shortages in certain technical fields. The sad truth is that not everybody can be an engineer.
By the way, it is not really true that almost all developed countries are in the same position as Japan. The UK, the US, France, and Australia are some of the developed countries that have birth rates very close to replacement levels, France being the highest. And there is a very big difference between a fertility rate of 1.4 (Japan) and 1.9 (the UK). Germany has a lower birth rate than Japan, but Germany also has high levels of immigration, a relatively low public debt burden, and a balanced budget. So no, Japan's combination of problems is uniquely its own.
But that's just looking at it from an economic standpoint. Obviously, from other perspectives a declining population can be a good thing. It will eventually create less of an environment burden, though presently that is not happening as Japanese builders continue to clear and build new large housing developments while ones that were only developed a few decades ago are now abandoned due to depopulation.
Just my two cents.