Just call `CRM_Core_BAO_ConfigSetting::enableComponent("CiviCase");`. It will enable it if not enabled already.