Interesting incident from the league cup

This incident took place in the league cup this week. It’s an interesting one with the assistant signalling for offside the ball goes back to the goalkeeper who when challenged head buts his opponent. The referee sends him him off after consultation with his assistant.

A few thoughts on the incident struck me straight away. If the player is offside has the referee blown straight away and the ball has gone back to the keeper to be setup for the offside, and if so technically the ball is out of ay and restart is the offside. Has he played advantage given the space the keeper has to keep the game moving, and but is there an advantage when the ball is back there?

Note -Post edited as for some reason the video did not upload when I posted this from my mobile