When you pushfirst!(y, z), you’re putting the matrix named z inside y. If you do it twice, y will contain [#= the matrix named z =#, #= the matrix named z =#, ...]. If you mutate the matrix named z, then that matrix changes. And since y has that matrix placed in two locations, you’ll see that change in both those locations. Because it’s just one matrix.
If you decide to do z = x[1,:]' in between, you’re deciding to repurpose the name z for a brand spanking new matrix — and that matrix will be completely independent from anything you might have called z in the past.