Can one modify Fly mode in blender to be active on press/hold of a key?
Sadly, I don't know of any way to customize it the way you want.
But you can at least assign the command to your custom mouse button.


Press Ctrl + Alt + U to open the Blender User Preferences. Go to the Input rider. You can edit the hotkeys in this context. Expand the 3D View > 3D View (Global) area.

Locate the View Navigation entry and change its hotkey to your mouse button.



With the button you enter fly mode.

You exit and confirm with the left mouse button.

You exit and abort with right mouse button.

Lifting one button couldn't differentiate between those to actions.