Hi Matthew,
maybe your programatic backup is being sent to the configured automated area because, in your code... you're using backup::MODE_AUTOMATED
and that makes backup to use the scheduled backup configured options to decide about final destination.
Surely using backup::MODE_GENERAL
instead will do the trick and you'll get a backup file stored into Moodle file area (personal backup area if the backup does not include users info and course backup area if the backup does include users info).
Hope it helps, ciao