For a while now BetterTouchTool [0] supports Logitech mice [1]. It's paid, but it's absolutely worth its price. It's super powerful and you can do all kinds of funky stuff with it, not only mouse related. I would suggest looking into it if you want more advanced features, I've been a very happy user for many years now.
There's also SteerMouse, which I use to configure my MX Master settings. One of the benefits is it's not something that needs to run continuously in your menu bar: you can set options and close it. In the end, it's just a basic peripheral...
I used to use it (better mouse) before BTT added Logitech support - but wasn't really happy with it. Every single update changed something, mostly my cursor speed in some small, but sufficiently noticeable way and I had to adjust it every time, which was super annoying.
At some point my settings kept getting lost every time my mac went to sleep, and I had to restart the app all the time. I messaged the developer, but never received any response or acknowledgement and I just dropped it. It's a pity, because I did like it for a period of time while I was initially using it.
The one thing I use the most, and how I found it in the first place is that it allows me to combine key presses with mouse gestures/movements. In particular it allows me to move/resize the windows under the cursor just by pressing a key combination and moving my mouse. Many many years ago I used to use AutoHotkey on Windows for this functionality and was missing it when I switched to Mac.
Another thing I've configured is scrolling through a key press and dragging the mouse. Or opening a floating menu by using the thumb button on my MX Master3.
And that's only mouse functions, I have a bunch of other shortcuts/remappings/automations, many of which run only for specific apps.
Have a look in the forum - it's a gold mine and a lot of people have shared their presets.
I've had a paid licence for it for many years but I have ended up shying away from using it because the UI is just so cumbersome. An incredibly powerful piece of software though.
I haven't tried the LLM approach recommended in the sibling comment, and I agree that the UI is quite cumbersome. Yet, once it clicks, it's still not super straightforward, but it allows for quickly implementing whatever one needs. I guess the UI complexity comes with its extremely powerful capabilities.
Get an LLM to generate a preset for what you want - it's ultimately driven by a json config. There are quite a few presets in the forum as well for various functions
[0] https://folivora.ai
[1] https://docs.folivora.ai/docs/normal-mouse/logitech