Not entirely about guessing. In fact, guessing isn’t involved at all, at least not after the first turn.
You left out that to do this, you need to have memorized basically all of the spymaster cards, or enough of them to increase the odds of you figuring out the configuration.
This is basically the same as the cheat in the memory match game in Super Mario Bros. 3 where you uncover matching power ups [1], and receive the power ups that you successfully uncover — but there are only 8 possible boards, so it’s way easier vs. this Codenames cheat.
Even if this is not technically considered cheating, it definitely would feel like cheating, since again you need to have knowledge of most of the spymaster cards. (And it goes without saying, this is definitely against the spirit of the game, even if it’s a neat party trick.)