Can you use CRM_Core_DAO::getFieldValue instead of CRM_Core_BAO_Extension::retrieve
since you only need is active flag on the extension.