I asked a GM and surmise the following answer. Basically all GMs have an "opening repertoire" which includes every opening. Some of them they'll know especially well, e.g. a player who specializes in the Alekhine's Defense will also know the opening to high depth, but even those who never play the Alekhine's Defense as Black will still know some theory. They won't know as much, but they will know some. In this it is similar to how I, having asked this question previously and internalized the answer, now know the theory of the Giuoco Piano a bit more.
However, not all lines are created equal. There are some lines which are known to be White's best tries for an advantage - e.g. after 1. e4 e5 2. Nf3 Nc6, if White wants to fight for an opening advantage, the "best" try is the Ruy Lopez. Therefore GMs will extensively study the Ruy Lopez. In the same way, the Sicilian and Petroff (and to a lesser extent the French and Caro-Kann) are major openings which anyone playing 1. e4 must be ready to meet.
This does not mean that GMs will always get the opening they want, but the lines they spend less time on are also generally lines which are inferior. Therefore if a GM runs into 1. e4 f5 on the board, they'll be quickly taken out of their opening repertoire, but they should already know enough about the opening to get an advantage. Facing this opening would still be an "opening surprise", but it would be a pleasant one - it is scary to play an unfamiliar position against a prepared opponent, but only if that position isn't in one's favor.
Notably at GM level the line between which openings are good and which are not can be quite surprising to amateurs. For example, it is reasonable to guess that neither Carlsen nor Nepomniatchi, in their World Chess Championship match, have prepared for the King's Gambit, the Bird's Opening, or even the Scandinavian Defense. If the opponent plays it then of course all their seconds will get to work on that opening, but a priori all their efforts are focused on the main openings.
Perhaps surprisingly, if opponent actually plays one of these fringe openings, the reaction is more of joy than dismay. In the example in the OP, a GM preparing to play Kramnik might prepare for the Berlin, but they probably would not find something highly effective. If Kramnik plays 1...Nc6, however, then the GM suddenly gets to play against a known-inferior line, and has a much easier route to an opening advantage.
Edit: as it turns out, even the French Defense is not something to prepare for at world championship level - see Nepomniatchi vs. Ding Liren, World Chess Championship 2023, game 7, where Nepo was clearly caught by surprise on move 1 and avoided the most critical lines as a result. This is even though Nepomniatchi has played the French Defense himself before, most notably the Candidates 2020.