Also - on the point of "everyone's been caught off guard with this":
A) Unsurprisingly, the countries which have responded fastest and managed to nip it in the bud (well... to varying degrees of whatever you want to define as "success" - looking at you, China) are those which have had recent prior experience with localised pandemics like SARS, and which built up both infrastructure to respond to future diseases as well as developed a popular cultural understanding of the kinds of behaviours required to help slow the spread. Or, if you're Germany, you actually built up the infrastructure in advance, in response to years of warnings from public health experts. Most countries are terrible at long-term risk mitigation, but it's not actually that hard to do - and it certainly doesn't let any individual country off the hook just because they're one of many, either.
B) This is kind of exactly why scientists and environmentalists have been screaming so loudly about climate change since the 80s. Even bigger problem, just as inevitable, and still barely anything's been done about it at the scale required to truly mitigate it because the measures required would feel a lot like what we're going through now in terms of disruption. Like quarantining cities, or entire countries, if it works, it'll feel like overkill - and you'll get hate for it from the public. I mentioned Tamiflu in an earlier comment, because the amount "wasted" on it by governments worried about bird flu is an apposite example here. In that case, several governments did scramble to get ahead of a possible pandemic... except it fizzled out, and the hundreds of millions spent on buying up stockpiles (only a couple of years before the financial crisis) did seem to make some governments and experts warier of being quite so proactive as a result. Damned if you do, damned if you don't, to an extent.