Hmmm ... the more we talk ... the more we hear about your setup! ;)
Cleaning up in moodledata/temp/backup/ is normally handled by cron job. If you found a backup.mbz file in one of those contenthashed named directories it was a valid backup but the process couldn't *copy* it to destination as per settings for automated backups. That .mbz file you probably couldn't cp either as there are limits on size of file to copy ... one could have 'mv'd it, however.
To get a handle when courses are next to backup ...
mysql> select * from mdl_backup_courses;
Your query above probably needs cli > to a txt file since you've got soooo many courses, but output looks like:
+----+----------+---------------+-------------+------------+---------------+
| id | courseid | laststarttime | lastendtime | laststatus | nextstarttime |
+----+----------+---------------+-------------+------------+---------------+
| 1 | 1 | 1559152201 | 1559152202 | 3 | 1583087400 |
Am guessing if one changed the 'laststatus' to some value other than 3 ... on server am looking at 3 is success, I guess. and changing the epoch time under nextstarttime to something in near future where could use something like:
watch 'ls -ltR /path/to/moodledata/temp/backup/[somecontenthash]'
of some in-cantation of ls.
Something about the courses that is causing so have you looked at them?
'SoS', Ken