First, there are currently beers that are served warm, particularly very dark ones. So part of it has to do with the character of beer.
There are two important factors I see, looking at this as a history nut but not knowing of any sources on this topic. The first, as you say, is widespread refrigeration. But this was not the major factor in cold beverages generally since ice was often preserved into the summer for cooling beverages (and has been since ancient times). But refrigeration makes this easier and thus cheaper.
The second is actually the modern bottlecap which is a product of industrialization. Before the bottlecap most beers were served uncarbonated. They might be chilled or not, but they would have been entirely uncarbonated, shipped in wooden barrels, etc. and had an altogether different flavor and character than our modern beers. My experience playing with these concepts as a homebrewer suggests that such beers were better suited to being served warm than comparably dark carbonated beers.
To understand why, I think you have to look at carbonation and how temperature affects that. Carbon dioxide is more soluble in cold water than warm water, so the warmer the beer is, the faster it goes flat, and the more it fizzes when opened. So you have two ways carbonation affects the picture. First it impacts the taste and serving conditions differently at different temperatures, and secondly it imparts a distinctive off-tang when the beer goes flat. Temperature helps offset the latter to a mild extent but at the expense of the former. I think this also helps explain why richer beers are more often served warm than lighter beers.