In either your player object or some kind of controller object, you'd put a variable. Then, in whatever block of code that handles destroying object9, have it add one to this variable (object_with_variable.variable += 1). Then in the step event of the object tracking this requirement, do the following:
Code:
if(variable >= 4)
{
if(instance_exists(object10))
{
instance_destroy(object10);
}
}
Also, if you're planning on repeating this on every level of your game, be sure to reset the variable to 0 at the end of each room or else the gate in the next room will automatically be destroyed too.
And as a side note, if you're naming your objects object9 and object10 in your actual project, I would suggest renaming them to something that's easier to identify at a glance (obj_gate and obj_key, for example). You'll save yourself a lot of confusion in the long run.