John 10v11-15 Laying Down

https://youtu.be/BNakPB03gFE

Jesus says he is the “Good Shepherd who lays down his life for the sheep”, but a good shepherd does not sacrifice himself, for otherwise the whole flock would be left alone to be attacked or lost.  So why is Jesus prepared to lay down his life?