Why couldn’t the hallway turn at the bend there? Those cabinets shouldn’t be sticking out of the back of the wall because normal cabinets don’t. With those cabinets gone and a slight bend there the hallway would be fine.
In episides showing the interior of the hallway, viewers will see that his apartment is on the left side, final door, of a completely straight corridor from central (?) elevator to back (theoretically exterior) wall.
You'll find this often in TV shows if you look for it. This is especially true when you're dealing with classic three-camera sitcoms since every relevant area and character must be viewable from one side of the room.