f is not a closure here, it is just a non const binding to the anonymous function (x,y) -> x^2 + y. And since you are accessing f from F you are using a non const global binding.
Because Julia has special functionality for dealing with the case of redefining functions. If you redefine the function f, what the compiler (basically) will do is to recompile everything that depends on the result of f. And since everything is recompiled with the new f in mind, then it is type stable again.