This went OK. I had some tangles with incompatible modules, almost surely my fault for doing things wrong. Fixing it was a good way to become more familiar with composer and the Drupal module system!
To get Drupal upgraded I edited the composer.json
file manually to remove the Matomo module, which was a bad idea. I suppose it was using its versioning info to signify that it was not compatible with Drupal 9. So once composer no longer knew that I wanted the Matomo module it was happy to upgrade to Drupal 9. But Drupal's internal config still knew that I had the Matomo module installed. Eventually I figured out how to uninstall with the Matomo module with drush, but only after figuring out a workaround for a bug with the module uninstaller. BTW the Matomo code was no longer in the modules/contrib
folder on my server and composer refused to install it since it was incompatible with the already installed Drupal 9, so I had to manually download the Matomo module code into that folder in order to be able to run the drush command to uninstall the module.
Then I found that I had similar problems with two other modules: popular_tags and tagclouds. Fortunately I WAS able to add and remove those at will using composer as I was learning that I needed to uninstall them using drush, and they did not have any uninstall errors. I actual wrote this up backwards--I think I figured out the Matomo module after solving the issue with these other two.
It would have been a lot easier to disable/uninstall those modules in the Drupal admin pages before upgrading!