Piper is a GUI wrapper for libratbag which supports a bunch of gaming mice that is great for customizing button mapping. It doesn't do per-app basis but once you map the mouse buttons to regular keys/commands you could use another application to do the mapping per application.
My Logitec MX Master devices can be configured on Linux via Piper. Logitech Options (the official software) is for Windows and I've never messed with it, even on my Windows devices. The two MX Master devices I have work plug and play and having 2 Bluetooth connections and a dongle channel lets me easily switch between my computers without swapping mice. Apparently with the official software, I could drag the mouse from one computer's desktop to another, but I'm happy to mash the little button on the bottom to tab between devices if it saves me having to interact with another hardware manufacturer's half advertisement/half utility app.
i havent found a mouse that doesnt work at all, but my side buttons arent working (probably my issue, but still). it more about a mouse manufacturer who treats linux users as first class citizens.