You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
The All Blacks coach knew Williams was in strife when he intentionally batted the ball back over the goal line from a cross-field kick early in the second half.
But as for the penalty try ruling, assistant coach Ian Foster had explain what was coming in addition to the yellow card that changed the course of the test.
"The Sonny one he doesn't know the rules because he was playing league," Hansen said.
"In league you're allowed to smack it over the dead ball line.
"I knew what Sonny did wasn't legal - that was rugby league. I knew that because a guy called John Kirwan did it in a Ranfurly Shield game years ago against Canterbury and got away with it... but we've moved on from that.
"I learnt a lesson from Foster that once you've committed an offence in the goal area it's like you're not there; they make you invisible and they felt the French man was going to catch the ball so it was a try and you can't do too much about that."
With Williams in the bin, the French stormed back with 10 unanswered points to steal the momentum and force the All Blacks to live without the ball for the majority of the second half.
Four first-half tries established a healthy buffer, but Waisake Naholo's late second try made the 38-18 victory look much more comfortable than it was.
"It was a good lesson for Sonny," Hansen said. "He'll know next time to catch it rather than hit it over the line."
Other than another patchy performance, the All Blacks have concerns elsewhere.
Dane Coles is awaiting results of a scan on the left knee he injured in the 13th minute after falling awkwardly while chasing a kick through. Coles scored the opening try and attempted to bravely battle on but reluctantly succumbed and limped from the field 10 minutes later, replaced by Codie Taylor.
"It's a bit of a mystery really we're not sure what happened. When the doc tested him all his ligaments feel pretty stable but he's obviously sore. He felt like his foot got caught in the grass. We'll wait and see what happens there."
Captain Kieran Read was also pulled eight minutes into the second spell - just after Williams went to the bin. Sam Cane switched to No 8 and Beauden Barrett assumed the captaincy through that difficult period.
The decision to replace Read at that crucial time was not scripted.
"He's got a slight groin strain so we decided at half time to give him another five minutes and see how it was then we'd take him off rather than risk aggravating it more. It's not a biggie, but it was big enough to look after him."
Read watched on from the sideline as the French steadily built confidence and put the All Blacks under serious pressure after being blown away in the first half. He felt his men kept the French in the contest with their ill-discipline, struggles to gain turnovers and protect their own ball.
"For a long period we couldn't do that so that's a lesson for us," Read said.
"It wasn't a complete performance but really happy with our first half performance the way we turned up and showed some good skills in pretty testing conditions.
"The lesson is how you keep going. It's a hard thing in sport when you're up by that many points to mentally keep a high standard. We probably dropped off a touch but really proud of the guys to fight - we defended well. Test matches aren't going to go your way the whole time."