Kozilek, the Broken Reality's triggered ability will resolve before Kozilek does. If Kozilek is countered or otherwise leaves the stack in response to that triggered ability, the triggered ability will still resolve as normal.