opengl – 3D projection matrix: how does z influence x and y?

I’m reading about 3D projections and I’m trying to understand how the z coordinate can have any impact on the x and y parts of a vertex. See, for example, https://docs.microsoft.com/en-us/windows/win32/direct3d9/projection-transform#a-w-friendly-projection-matrix:

w  0   0     0
0  h   0     0
0  0   Q     1
0  0  -Q*Z_n 0

How is it even possible to introduce a perspective if – clearly – there is no z involved in computing x and y (the above matrix works on column vectors).