Thanks so much for your comments; these are very useful.
… rotation should work regardless of the filename …
I like your idea. After giving this more thought, perhaps the best approach is to let -debuglogfile=path to work as usual, but create a directory with a fixed name like rotated-logs (or rotated-debug-logs) and put all the rotated log files within that directory. (The active debug log file, debug.log or as specified by -debuglogfile, would be as it is today, no change.) Because the rotated log files are in a directory with a specific purpose, they can have simple names like 2021-06-27T15:10:55Z.log. They wouldn’t have to be named according to the -debuglogfile argument.
This would have an added benefit: As I’ve been running this code to test it, my data directory now looks “messy” or polluted, with all these rotated log files that usually aren’t very important – why should they be so visible and prominent?
0$ ls ~/.bitcoin
1banlist.dat   debug-2021-06-27T21:19:42Z.log  fee_estimates.dat  signet
2banlist.json  debug-2021-07-09T00:38:43Z.log  indexes            testnet3
3bitcoin.conf  debug-2021-07-14T16:32:30Z.log  mempool.dat        wallets
4bitcoind.pid  debug-2021-07-17T14:01:27Z.log  peers.dat          wallets-empty
5blocks        debug-2021-08-10T20:03:04Z.log  regtest
6chainstate    debug.log                       settings.json
7$
(And I’ve got only 5 rotated log files; there could be many more.) A small disadvantage is that it would be slightly more difficult to concatenate (or grep) all of the log files in time-order:
0$ cat rotated-logs/* debug.log
(instead of just cat debug*.log) but that’s not bad.
So unless there are objections, I’ll make this change within the next few days.