Make package restore robust to database downtime

Construct package blob URIs directly based on the package download request URI instead of going to the database. And also remove various problematic dependencies on the database, which happen when you hit the download URI like GallerySettings.