It’s interesting; I assume you’re using “mental gymnastics” in a derogatory sense but I love those questions and I would love answering them. I’m actually a bit peeved that no one is asking me them right now.
It's perfectly reasonable to expect a developer to be able to recognize patterns and repeat them.