The source of the original circuit design, seems to come from here (speculation, I could be wrong, but it seems amazingly similar):
https://www.electroschematics.com/11918/auto-12v-bulb-failure-warning/The Opto-isolator, seems to have been put in (as regards the link, above), for future options, rather than because it is needed now.
I presume, the OP, based their circuit on the above linked circuit, and have added a relay and changed it, for reasons unknown. I can only guess at what they are trying to do.
For anyone who is curious, schematic copied here (from link, above):
Then below it, is what the final unit would look like:
/?action=dlattach;attach=592855;image)
/?action=dlattach;attach=592861;image)