I’m guessing that there is no external mute button, as there is on my laptop.
Let me see if I get what you’re asking here. You want the headphone jack to be fully functional at all times and in all conditions, and the external speakers to only function when you tell them to. Right?
I doubt that there is a software setting that will allow you to just disable the external speakers without also affecting the functionality of the headphone jack.
The closest thing I can think of to a solution will definitely work, but requires you to swith the plug out when you want to use it. As mentioned above, you can keep the headphones plugged in, or just use an adapter or old plug from an old set to effectively “mute” the external speakers. If you want to use the jack, either put on the headphones if you’re using those to mute the speakers, or remove the “silencer” adapter or plug, and then plug in the headphones.