I understand your reaction . . . it's sort of weird to say it before the game actually ends. People often send it on games they win (to show respect for a well-played game, or at least for a fun game) and also for games they lose (to show good sportsmanship). So, I would not read into "good game/gg" that they are prematurely conceding the game and/or celebrating their assumed victory.
So, why do they do it? I think because many many many people will leave a game immediately upon winning or losing. That's happened to me. I want to type out a "thanks for the game" message, or "that was a great and unexpected strategy you used" message . . . but I get no chance to--they've already disappeared.
Maybe this premature 'good game' is just a way of them insisting on being friendly and polite??? (Or maybe it's done for an entirely different reason--I'm totally speculating, above.)