Indeed, all of the data is under a profile folder under
.thunderbird. That includes all account configuration, preferences and cached and local email folders. The name of a profile folder starts with a random unique number, and has an extension .default-release` in more recent versions of Thunderbird.
To locate the profile folder that is currently in use, click the hamburger menu (☰) in Thunderbird, then select "Help", then "Troubleshooting Information". Clicking the button "Open Directory" next to "Profile Directory" will open your file manager in the profile folder. In most file managers, you can then press Ctrl+l to display the full path name in the navigation bar, and copy it from there if needed.
If you backup that entire profile folder, you will backup your entire configuration. Restoring the folder on a new system will have Thunderbird act as before.
In some cases, you may be interested in backing up local folders only. That is unique data in contrast to cached mail from IMAP servers, where the mails exist on the server, and in contrast to server configuration data, where your ISP has the information on how to connect. Locally stored mail could be mail you remove from an IMAP server for backup, or could be mail retrieved from a POP server. That mail lives under /Mail/Local Folders.