Putting his head in the corner gives him a visual barrier that should help stop him from walking off. That said, horses recognize individual riders. This one has evidently been nipping at the boundaries for a while. It sounds like you are beginning to recognize it. Yes, if the horse anticipates a canter and starts to increase speed, don't ask for the canter. If he canters without the cue, the moment he breaks pace, correct and make him trot until YOU ask him for the canter. If he steps out before your command, bring him back to the starting place and make him stand. If he changes his paces at the instructor's vocal commands, correct him until YOU tell him to change. (Some lesson horses get so familiar with vocal commands, this actually does happen.)
You are always training a horse when you're with it. Every horse, every time. You can teach it good habits or bad habits, but you're always teaching it...whether you're teaching it to respect you or not. Heck, my leased mare is twitchy about saddling, and she KNOWS better than to move (come to Jesus meeting on our first day together), but if I don't correct her sharply at the least movement, she'll move again, further. All horses are opportunistic to varying degrees. Don't let your lesson horse make you his opportunity.