8 – What is the correct order of disabling the default contact form on Drupal?

Drupal comes with a default contact form on each site we install. And while we already have the webforms and recaptcha module installed, some of our site owners still use the default contact form found in
/admin/structure/contact.

I need to remove them because when they are enabled, the site is prone to spam attacks. I’ve had a few instances where some of the sites had form submissions with PDF file uploads of inappropriate content. So you see how this is a security risk for our organization.

I removed that contact form in my local site by disabling the following modules in this order:
contact form
contact storage
contact

But I need to do this for all our sites now, so I wrote the following in my profiles_update() function:

function my_profile_update_8011() {
    $config = Drupal::configFactory();
    $moduleHandler = Drupal::service('module_handler');

    if($moduleHandler->moduleExists('lightning_contact_form')) {
        Drupal::service('module_installer')->uninstall(('lightning_contact_form'));
    }
    if($moduleHandler->moduleExists('contact_storage')) {
        Drupal::service('module_installer')->uninstall(('contact_storage'));
    }
    if($moduleHandler->moduleExists('contact')) {
        Drupal::service('module_installer')->uninstall(('contact'));
    }

}```

When I deploy this update to our dev environment, it would work on most of the sites, but fail on the rest. They all have this same error message:

The error output from the server was: > (notice) Update started: my_profile_update_8011

(error) SQLSTATE(42S22): Column not found: 1054 Unknown column ‘id’ in ‘where clause’: SELECT 1 AS expression
FROM
{contact_message} t
WHERE id IS NOT NULL
LIMIT 1 OFFSET 0; Array
(
)

(error) Update failed: my_profile_update_8011
(error) Update aborted by: my_profile_update_8011
(error) Finished performing updates.


All our sites share the same codebase, so I don't know where my update hook went wrong.
Is there a better way of disabling these modules?

thanks,
Kevin