attempt to rebuild cases JIT during OTA restore

also adds ability to rebuild a nonexistent case as long as there are relevant forms that touch it

and tests

should hopefully fix all case-processing-related manifestations of http://manage.dimagi.com/default.asp?52949