

The AfD was never going to end up in government from the last election. They would have to try a three way coalition with the Greens as well. However such a coalition sucks for everybody and can not really produce the necessary change. Even the current one is less the popular in both parties.
That is especially bad with Germany being in a bad place already. The economy has problems as the massive car industry has to transition to electric and those cars require fewer workers. The baby boomers are starting to retire, which helps keep unemplyoment low, but also means less cheap workers and higher social spending. Trumps tariff chaos is horrible for an export power house like Germany. Then the war in Ukraine is too close for comfort, so weapons have to be given to Ukraine, which costs a lot. At the same time no longer buying Russian fossil fuels drives up energy prices. The obvious solution of going green means massive new investment as well, which costs a lot and it takes time. All while infrastructure is crumbling due to the government not wanting to go into debt.
The Palastine situation just sucks badly. Antisemitism accusation are a given, when you attack Israel and they land especially hard in Germany, given German history. So you end up with a very confused foreign policy. Offically calling for full support of Israel, while abstaining in the UN. Politicans being very clear about wanting to sell weapons to Israel, while at the same time blocking anything, which explodes to be sold to Israel for over a year now. Similar with UNRWA, cutting off aid and then resuming it a few months later and restarting that. Basically Germany is talking the big talk about support for Israel, due to being afraid of being called antisemitic, while half assing actual support of Israel. The problem being that even half assed support is still really unpopular globally and people look mostly at what is said, rather then what is being done.
You do need to care for the elderly, but you also need to care for young people. Schools, kindergartens, universities and so forth cost a lot as well. As long as the life expectancy and fertility rate are stable, the population ends up with a stable dependency ratio. A below replacement fertility rate, just means that the population ends up shrinking.
As for funding the welfare state, the problem is GDP per capita. As long as that is stable in real terms, the problem becomes distributing the wealth. There are actually some good things in terms of GDP per capita with a shrinking population. Namely we still inherit the assets from previous generations. We can choose to the best housing, factories, infrastructure and so forth. Not only that, but we still have innovation, so a lot of our economies are still growing.
For Germany for example current UN predictions are at 30% of the population being retired starting around 2035 and until pretty much the end of the century. Currently it is 23%, so the impact is happening today. That is about what Japan has right now.