It’s a paid piece of software, not free, but it’s worth the price imo.
I use it mainly for transferring photos from my iPhone to my MacBook Pro M1.
But I know that iMazing can back up WhatsApp messages as well, among other features.
https://imazing.com/guides/export-and-print-whatsapp-chats-f...