It turns out that I had implemented the functions for the hooks in the Gallery module I've been writing. Apparently, Drupal doesn't look in the embedded Gallery module for hooks.
When I took them out of the Gallery module and put them into their own *.module file, added a corresponding *.info file, and moved them under the Drupal modules directory, the functions started being called when the cart function was invoked.
Now I'm trying to figure out how to get a thumbnail to appear in the cart for the programatically added product. Do you have any suggestions?