When I was young, my first real experience with this was seeing a black and white spiral optical illusion in a museum. I stared at it for a bit, and then my brain adjusted and when I looked away, it affected what I looked at.
I think my realization was that my brain didn't just do simple things, it did complex in many dimensions to adapt and fix things.
The same thing goes with your foot, and it goes way deeper than we realize. It's probably not that one muscle, it is ALL the muscles in the area working together to help you walk. I wouldn't be surprised if there are 50 muscles involved.