It doesn’t project straight to 2D. That would be an awful limitation.
With a three-row matrix you can only do W buffering (or no depth buffering at all, obviously). Note that W is required for perspective correction anyway. You can’t support textures in any sensible way without it.
But OpenGL uses Z/W for depth buffering, so its matrices need to have four rows to produce X,Y,Z,W.