It's not just the welfare state that makes this possible, it's maybe more so the fact that (as far as I understand) Germany has a functioning housing market, and Berlin especially is very cheap for such a big city.
In many parts of Europe housing costs would have killed you.
Berlin is affordable, because, like Leipzig and Dresden, it's in former East Germany. Most of the country's economy is still concentrated in West Germany[1] (Munich, Frankfurt, Hamburg), which is much less affordable.
A friend of mine who lives there told me rents cannot be increased by more than the current inflation rate for years. It’s only every x years that landlords are allowed to adjust to market rates or something.
Can someone from Berlin confirm that this is accurate?
In theory, there is some law that should prevent rent increases too much but you would not get anything like that anymore now. Now you get fixed term contracts and after that rent will increase by whatever amount is possible. The time you describe is over (and only valid for old but still existing contracts)
Because before, it was even more affordable (prices doubled in the last ten years already) and before that there was no Berlin (in the form we know it today ...)
In many parts of Europe housing costs would have killed you.