A molecular switch orchestrates enzyme specificity and secretory granule morphology