Regarding liberties Germany actually had a pretty good track record up until WW1 (considering the standards of the times).
How could its economy have outpaced the ones of France and Great Britain by then? Liberlization did. Its what made Germany a jewish "america" for Ashkenazis all over eastern Europe. Social Security, Kindergarten and other institutions were formalized. Even with WW1 and its subsequent burden of the overreaching Versailles-agreements, the people of Germany were living in a newly found state bound to fail - but were still the same people.
Berlin in the 20s had the most vegan restaurants in the western hemisphere. Gays were more accepted than for a long time to be seen in the west.
The scientists you cite got their educational groundwork to build upon out of these decades of progress.
Decades of work that shouldn't get discounted so casually ("wasn't exactly...").
I know this isn't a history thread but since we're using history for making helpful generalizations getting history right helps. And Germany was certainly not "all-brownshirts" from 1900-1945 :-)
I interpreted the comment I replied to as saying that it was liberal values in its own right that created a good scientific climate for discovery. It can be argued that even though the German states tended toward a liberal trajectory well before unification, and continued to make headway afterwards, it was largely driven by pragmatic policy rather than any such ideology. Bismarck in particular was no liberal, but nevertheless enacted several reforms towards such end.
What Germany did have, though, was an ancient academic tradition going back hundreds of years, with significantly more universities than other countries. This was largely due to the fragmented nature of states pre-unification, and the many different denominations of Christianity. I'd argue that it was this tradition that came to fruition, and that it was despite of the nationalistic elements of German society.
An interesting insight into science in this era is "The dilemmas of an upright man" about Max Planck.
When individual liberty became more entrenched in culture, suddenly scholars were considering non-deterministic phenomena everywhere.
(I'm sure there's a million of counterexamples; I am just noticing a broad trend.)