It’s an issue related to the grid used for binning.
Let’s use a smaller example.
set.seed(42)
x=runif(10^3)
y=runif(10^3)
z=rnorm(10^3)
new.data=data.frame(x,y,z)
library(ggplot2)
(g <- ggplot(data=new.data) +
stat_summary_2d(fun = mean, aes(x=x, y=y, z=z)) +
geom_point(aes(x, y)))

Now let’s zoom at that box on the upper left corner
g + coord_cartesian(xlim = c(0.02, 0.075), ylim = c(0.99, 1.035),
expand = FALSE)

As you can see, that box starts below y = 1 but extends above that value
because you are binning observations according to some binwidth.
The same phenomenon can occur if you use a histogram.
ggplot(data.frame(x = runif(1000, 0, 1)), aes(x)) +
geom_histogram()
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

In geom_histogram this can be aboided by setting the boundary argument
to 0 and the amount of bins to a multiple of the total length.
ggplot(data.frame(x = runif(1000, 0, 1)), aes(x)) +
geom_histogram(boundary = 0, binwidth = 0.1)

So the solution in your case is to set binwidth to 1/n where n is
an integer
ggplot(data=new.data) +
stat_summary_2d(fun = mean, aes(x=x, y=y, z=z), binwidth = 0.1) +
geom_point(aes(x, y))

Created on 2018-11-04 by the reprex package (v0.2.1.9000)