It all starts with Rule 61.3 of the NHL Rule Book, which provides as follows:
61.3 Major Penalty - A major penalty, at the discretion of the Referee based on the severity of the contact, shall be imposed on a player who slashes an opponent. When injury occurs, a major penalty must be assessed under this rule.
This Rule doesn't require that the player who was slashed be injured as a result of the slash (although it would probably help). Rather, the referee can assess a major penalty if in his discretion the slash was sufficiently "severe". That's a judgement call.
Ok that's the rule for the Major Penalty. How do we go from the major penalty to a game misconduct? That's Rule 61.5:
61.5 Game Misconduct Penalty – Whenever a major penalty is assessed for slashing, a game misconduct penalty must also be imposed.
So the referee in his discretion believed the slash was sufficiently severe as to merit a major penalty. As a result, he then had no choice but to toss Subban from the game as per Rule 61.5.
It's not relevant that Stone came back to the game. All the referee has to believe is that the slash was severe enough to warrant a major penalty. Of course, if Stone didn't drop to the ice in a lot of pain, the call might have been different.
On to period three.