Generating two-dimensional quantum gases with high stability