This is interesting. I was just discussing this with my friend last night, and proposed this exact solution. However, it's still a reactive solution. It will detect that you may be the victim of a stingray attack, but it won't stop your phone from connecting in the first place. But there is another potential solution, I just don't have enough experience developing android roms to say how it would have to be implemented. The idea is this: maintain a database of all know cell towers (your link to OpenCellID would do nicely, they offer their DB for download). Using a rooted or fully custom ROM, such as cyanogenmod, have the phone compare any new tower to the database prior to connecting. If it doesn't exist in the database, red flag it and don't connect.
The question is, can this be done on the OS level, or does it have to happen on the driver level? If it can be done at the OS level, easy peasy, just modify the code to establish tower connections to include this check. If it has to happen on a driver level, it gets trickier. Most phones use proprietary binary drivers for their cell radios, so they couldn't be readily modified. However, it may be possible to load an intermediate driver, which in turn loads the proprietary driver. If it could be determined which driver calls involved connecting to a new tower, you could just pass through everything else, and only pass through calls to the tower connect function if they passed your database lookup. Trickier, but doable. Because really, you want to avoid connecting to these things at all. Nice though it is to see you're being attacked, it's better to stop the attack before it starts.