Is there a way to stop macos from changing audio input when new device connects? As in the subject, I've searched for the answer to this online already, but found nothing. I am advanced user myself, but have not found any way to do this.
The gist - I have my preferred audio input device, which is a USB microphone. I also do have my preferred audio output device, which is wireless headphones. These headphones also have built-in mic. The issue is that whenever I connect my headphones (turn them on -&gt; automatic connection via bluetooth), the audio devices on my mac automatically change. I am fine with automatic switching of audio output device, but audio input is annoying one is 100% of time after turning on my wireless headphones I need to open sound preferences and change input device to USB microphone. From what I observed, this happens for any new input device that connects to macos.
The question: Is there any way to disable automatic switching of audio input device whenever new one connects?
PS: I have seen these Qs, but there is no acceptable answer:

Set audio input/ouput device priority
Stop Automatically Switching to Bluetooth Audio
No. This is the prescribed behavior as you've already noticed.

I am fine with automatic switching of audio output device, but audio input...

How is the OS supposed to differentiate the difference between the one (device) you're OK with and the one you're not?  The way macOS sees this is that you've plugged in two distinct audio devices - input and output.  It then switches to them because  your Mac the assumes you want to use that device now as you've connected it; so it switches to it.
A quick workaround would be to disconnect and reconnect your USB microphone after connecting your headset. You would probably have much better results if you connected the headset via cable to a USB DAC rather than Bluetooth. This way, audio always sees the USB as connected  whether or not a headset is connected - the auto switch won't engage.
I do this with my Bluetooth Sennheiser headset (headphones and mic) effectively turning it into a headset only device.

Audio Recording
I'm adding this in here because the OP mentioned in comments that this was for an &quot;audio recording&quot; setup. This section will attempt to address issues in this context.
Your Bluetooth headset is the wrong tool for the job.
macOS is designed to be (out of the box), something that you plug in an it goes to work.  I'm not saying it can't be used for audio recording.  What I'm saying is that it's architecture for the user to open the lid connect their things and start working.  This includes audio devices and the behavior you're seeing is that philosophy in action.  Why they chose not to do allow you to tweak it is entirely an Apple question.
So, whether Apple intended this behavior or not, you're using the wrong gear to record audio.
Bluetooth headsets are probably the worst thing you can do for audio recording/production.  You have inherent latency (radio signals are slower than electrical signals which travel the speed of light), the DAC inside the Bluetooth headset is nowhere as robust as the DACs of proper equipment and you don't get the necessary, granular, control necessary for proper audio recording. It's also prone to external interference, noise, and general signal quality issues.
Just taking a very simple example - watch the evening news where they interview someone remotely and you can easily see the difference between someone with Airpods (as good as they are) and someone who spent a little bit extra on a proper microphone, a proper headset - and this is before we get into acoustic foam and mixers and gear!
If your goal is to record audio, you need a quality microphone and a quality interface (aka a mixer).  If you're just getting started, you don't need to spend buckets of cash to make this happen.  You can get a proper microphone input for under $50USD.  This will allow you to have a quality DAC, an input that you can control and a monitor port that will allow you to hear your input (your voice) before and after it goes through your Mac.
As you grow and add instruments or more voices to your recordings, your equipment should grow along with you.
Bottom Line
A Bluetooth headset is designed for listening or making phone calls.  Can you do recordings with it?  Sure.  However, it's not designed for it and it will show.  You need the right gear for the job: a quality microphone and a proper interface to capture and/or output that sound.  Short of that, and the quality of your final product will suffer.