Why is there two sets of black and white wires connected together in my wall?
It could be a switch loop, that box would be legal as a junction if a cover was installed. I would want to clean that up with wire nuts and tuck the wires in the box and add a cover.