No idea about the gas line. In our basement they painted it yellow, but in the apartment they didn't.
It's definitely extremely shoddy work. Only the last box represents how work has been done here for ages (apart from the blue and black wires in the background). It seems like the cover has been missing for quite ome time judging by the dust that has accumulated on the splices.
The first pic looks like a junction box that has been smashed.
Pic #2 looks like 1950ies work, it's still an old metal box with cardboard lining but the cables are plastic. The guy obviously tried to squeeze in the box below the pipework, no idea why he didn't go a few cm lower. The box has definitely been messed around with after it was installed, there are blue and black wires as well as grey and black.
The wires in pic # 3 look newer.
Pic #4: box is probably the same age as #1. All the wires having the same color and the way the splices are made looks really familiar to me. Until the 1970ies most splices were just twisted and taped, originally with cloth tape, later with plastic tape, at least when doing work on existing installations (in new construction strip connectors (choc blocks) caught a bit earlier, but not before the late 1960ies). Where I live now I've opened dozens of junction boxes that were stuffed with all-black cloth wires spliced like the ones shown in the pic. If they were twisted real good such a splice will last pretty long. The original 1914 splices didn't make any problems, only one in the bathroom did (complete rewire in 1962).