Maybe I'm crazy but I just have a cron job that does .backup during a time with little activity. My db is only 40GB or so and stored on an NVMe so it finishes quickly.
Here's how to use .backup:
sqlite3 data.db ".backup 'backup.db'"
You can also do this: sqlite3 data.db 'VACUUM INTO "backup.db";'
That's slower, but results in a smaller backup file: https://www.sqlite.org/lang_vacuum.html