From the Wikipedia page on gills that you link:
The density of the water prevents the gills from collapsing and lying on top of each other, which is what happens when a fish is taken out of water
Wikipedia's source for this statement is a biology textbook: M. b. v. Roberts; Michael Reiss; Grace Monger (2000). Advanced Biology. London, UK: Nelson. pp. 164–165 though I'm not able to access this source.
You need a lot of surface area for gas exchange. If the gills collapse as they do if not submerged in water, there's not enough surface area for gas exchange. If you did somehow spread them out mechanically, they'd dry out. You might think about how a net can sit expanded in water, but if you pick it up it all bunches up; same as gills.
Gills are very delicate, almost paper-like structures that depend on the buoyancy of water to remain open. The fragile gills will collapse if the fish is taken out of the water because air doesn’t have the same density and buoyancy water has to keep the gills open and functioning. This is why a fish cannot live outside the water.
https://blog.limnology.wisc.edu/2016/09/14/at-home-in-the-water-condemned-to-life-on-land "This essay originally appeared in the Lakeland Times in Minocqua, Wisconsin. Carol is an Aquatic Invasive Species expert and outreach specialist with the CFL and Wisconsin DNR."
A paper on a fish with modified gills that allow it to breathe in air:
The bowfin, Amia calva is a facultative air breathing fish restricted to North America and is reported to estivate. ... The secondary lamellae are fused to form a lattice-work of rectangular pores, a gill arrangement unique among freshwater fishes. This highly modified gill structure imparts considerable rigidity such that these do not collapse upon air exposure.
Daxboeck, C., Barnard, D. K., & Randall, D. J. (1981). Functional morphology of the gills of the bowfin, Amia calva L., with special reference to their significance during air exposure. Respiration Physiology, 43(3), 349-364.