Only 5 of 180 photos did this kind of display.
You didn't say, but it seems you are saving raw files. The affected files are being corrupted in some way. With only five out of 180 photos affected, the best guess is that the memory card itself is the culprit.It is remotely possible that the files are being corrupted by the camera's data pipeline. It's also possible that a hardware issue between the memory card and your computer is to blame. If you are using a card reader, the reader or the connecting cable could have an intermittent fault. If the same hardware connection is being used to transfer images from the card to your internal file system, it is remotely possible the images are intact on the card and being corrupted in the transfer as well as when the system attempts to read them.
What you are seeing when you first open each image is a jpeg "preview" image that is processed by the camera and attached to the raw image file when it is saved on your card. You are seeing the rectangles when Lr or DPP replace the jpeg preview with their own processing of the raw image data.
Your next step should be to try a different memory card and see if the issue continues to present itself or not.