[pyramid] Don't use unsafe_cnx_context_manager for write queries
we may have clumsy error that hide previous problems on attempting to commit the transaction.
Closes #16753531
Repair database wrt indexes / unique constraints
* recreate indexes dropped by 3.23 migration (but it's still unclear why)
* attempt drop remaining extra indexes (there may be a bunch of these on old instances)
* warn about missing expected indexes
Closes #16666137