Those welfare states were built around a small, homogeneous, mostly like-minded population with low-priority, token military forces that are little more than extensions of the welfare establishment. As everywhere else, politicians get elected by promising short-term benefit levels that can't possibly be sustained long-term. They want to be admired as generous, but the reality is that even modest immigration speeds up their date of reckoning to the point where politicians can no longer count on retiring comfortably before punting the mess to the next generation.
Bloomberg might want to point out to Sanders that Denmark is nowhere near as populous, diverse or complex as the city he governed.