The defender knocked the net off but the puck would have gone in regardless so good goal.
NHL rule 63.7:
Awarded Goal - In the event that the goal post is displaced, either
deliberately or accidentally, by a defending player, prior to the puck
crossing the goal line between the normal position of the goalposts,
the Referee may award a goal.
In order to award a goal in this situation, the goal post must have
been displaced by the actions of a defending player, the attacking
player must have an imminent scoring opportunity prior to the goal
post being displaced, and it must be determined that the puck would
have entered the net between the normal position of the goal posts.
If the goal post is deliberately displaced by a goalkeeper during the
course of a “breakaway,” a goal will be awarded to the non-offending
team.