Wirenuts, that 'bottle' contains a euro-style receptacle, and is filled with expanding foam. It's rather similar to what Joe T had in his infamous 'soap bottle' extension cord - only this one has space for several cords to plug in.
As for the receptacle and switch in the last picture being at different heights, there might be a fire-block in the wall, preventing a cut-in box from being set higher. Many pre-1960 homes had fireblocks offset at about the 4ft. height.