Is there a way to set microphone input volume level if a change is detected in input volume level?

You can bind both output volume & input volume in one script that can be accessed via Script Editor.app > preferences > show app icon in menu bar.

tell application "System Events"
    set volume 2 -- this can be from 0-7
    set volume input volume 50
end tell