D Flip-Flops at MCU IOs
The fact that there's a multi-flipflop IC in the path between MCU output and optocoupler will have multiple reasons:


drive strength: The LED within an optocoupler needs some defined current – the MCU might simply not be able to supply or sink current  for each LED or for the sum of all. The flipflop output might be able to do that!
level translation: The LEDs might want a different voltage than what the MCU can directly supply; a flipflop with a different supply voltage might solve that. Same in the opposite direction.
stability: If the MCU crashes or browns out, these flip flops would ensure the output state gets preserved. Some flipflop ICs (not this, I think) do also have Schmitt-trigger inputs to increase noise/ringing immunity
synchronicity: This very much depens on the MCU, but usually, you can switch only a limited amount of outputs at a given time (for example, one output bank a 8 outputs, at most). If it's critical that switching of a greater number of output happens within a very short time frame, it would make sense to switch the MCU outputs in what ever order and time you want and can, and then latch all flipflop outputs at once using a single latch output.
versatility: as long as you don't touch the latch line, you can do whatever you want to the MCU outputs without changing the state of the optocouplers' inputs. So, if your MCU has run out of pins, and you don't have to switch the optocouplers all the time, then this is an easy way of getting two usable outputs out of one pin. This theory is supported by the fact there's vias in the signal lines going to the flipflops on your photo.