The space behind the lens is actually a miniature representation of the space in front of the lens.
This space is 3 dimensional, just like the space in front of the lens.
It isn’t until you add some sort of sensor that you flatten the area behind the lens into a flat image.
Just sayin’