I have had the exact same issue as you. Thunderbird is great, but their attachment search is not. I spent a lot of time looking for a way to make it work and what I settled on is using a third party program to serve this function: Recoll (https://www.recoll.org/index.html).
It should be available in your distro's package repository.
You'll need to download your messages to your computer, but it will work in the way that you expect search to work (I.e. search by filename, search by text within attachments, search by text within emails). Setup is straightforward. You just need to point it to the Thunderbird profile directory where your emails are saved. As a bonus, you get good desktop search for all the other files on your computer too.
Sadly (don't throw anything at me), the only desktop email program that I have found that does search properly is Outlook desktop. On Linux, that is obviously a non-starter.
Recoll (thankfully) has a GUI. It isn't the prettiest app, but it was easy to set up and I've otherwise quite happy with it.