I've found plenty of discussions on disabling Gatekeeper, though little info on re-enabling it. In particular, how to (re-)set Gatekeeper to "Allow Apps downloaded from: Mac App Store and identified developers". I've found that spctl --master-enable will sometimes set Gatekeeper to "Allow Apps downloaded from: Mac App Store". By adding spctl --enable --label "Developer ID" I've been getting the result I want.
The script can be found on my github
