Well, I figured out what was wrong. Thank god. In the config.php file (which, of course, I had been very careful not to overwrite) it was incorrectly listing my application version as being public beta 2:
$conf[‘app_version’] = “009”;
This was confusing the upgrade program, since the version on my server was 1.0.
So I manually changed the config.php file so that it listed the correct version (100). And then, hey presto, the upgrade script ran without any problems, and all my templates and category groups magically reappeared.
The config.php file now lists the correct version (110).
I have no idea why it wasn’t listing the correct version before.