That's one version, and the official party line one. Considering the country of origin, the original military of intention (Austria), and initial military contracts (Norway and Sweden), it makes sense
A concurrent/alternative possibility is for reasons of molding/manufacturing simplicity.
When you move to hotter, dustier climates, or environments where there is a real likelihood of high-velocity particulate matter being forcibly introduced into the area (i.e., from sandstorms, dust/dirtstorms, or rotor wash), the cavity becomes a chute in a bad sense-channeling the junk into the action component areas, potentially inducing operational issues.
This was famously (or infamously) publicized in Larry Vicker's sandbag test with a early G21, where a G21 (and several other pistols; the HK USP and Colt 1911A1 come to mind) were put in a sandbag with the finest of Fort Bragg/Fayetteville NC sand, shaken, and then attempted to be fired. The results with the G21 weren't pretty. Vickers, not a G21 fan, proceeded to make some other snarky comments about other G21 issue areas (which had probably actually been dealt with before Vicker's comments), but his basic finding I believe to be correct-use a butt plug to preclude crap from jamming up the works if there's a likelihood of such stuff being introduced, and things will likely be much better.
It took me awhile to be a convert, but now all of my Glocks get a plug as a matter of course. The plug precludes stuff, including snow and ice from getting in, and if the weapon is immersed in water, there still should be adequate drain points, or it's easy enough to quickly field-strip and shake things out.
And yes, it can be easy to get things up the cavity-last year, when hunting in the Pacific NW, with the G21 as back-up in a tactical thigh holster, when sitting down during a break, the gun's hilt was jammed into the mud. The plug nicely precluded any from entering.
Even if your Glock is only used for concealed carry or shot in an environmentally controlled range, the plug can prevent insidious dust bunnies or other debris from potentially becoming introduced into the operating mechanism of the gun-which is probably a far greater potential reality than snow and ice. And it's not like the silly things cost an arm and a leg, or require gunsmith installation.
Best, Jon