This reminds me of an actual experience I had a few years ago. I was training a reinforcement learning robot to navigate a (simulated) maze. This was for a competition at my university. The organizers provided us with an API where we would get a maze layout and the position of the robot and several exit points and “treasure” locations. Goal was to have robot leave the maze before a timer expired but the ranking was based on how much treasure you got.
After several hours of training, I got a robot which could navigate all the mazes that were generated by the  API, getting good exploration-exploitation balance. Then, we decided to train the pipeline so that instead of using the maze as provided by the API we used a rotation of it. Turns out the robot was getting stuck most of the time.
The reason? The maze generation algorithm that was provided in the API was biased to mazes that had long horizontal corridors and very short passages to next rows. So our robot was overfitting on this feature.
It was easy to fix and it turns out the organizers also fixed this in the generator for the actual competition. So only a few number of robots managed to score points during the actual event, as those teams put extra care towards preventing overfitting to the training data.