Your pathfinding implementation doesn't properly check whether a stoplight is never going to be green when approaching from a certain side, as demonstrated in this screenshot: https://i.imgur.com/xvqKPSY.png
Right, the pathfinding actually ignores stoplights. This is because it's built on squares either being "on" or "off," while a stoplight adds a directional aspect to it. If I generalize the pathfinding to allow for directed graphs (it would be a serious generalization), then it could allow for permanently blocked stoplights and even one-way streets.