In theory ancient landline telephones had such circuit. I have heard it called side tone suppression hybrid. It was developed because people hated to get their own voice or local ambient noises loudly to their own ear. Think your headphones in the place of the telephone handset mic, the audio source in the place of the remote telephone and your recorder in the place of the speaker of the telephone handset.
The recorder gets what's outputted by the audio source. There's also bidirectional connection between the headphones and the audio source. The audio source doesn't care but your headphones get the audio.
Old telephones used transformer based hybrids to avoid signal level losses, but a modern audio source which can feed modern low sensitivity headphones can well afford a part of the wattage getting dissipated in resistors. For a start of such circuit see this schematic:
It has a speaker of your headphones in a resistor bridge. If R1/R2 = R3/R4 no output from the headphones causes any input to the recorder. It's said that resistor bridge is balanced if the equation is true.
In the next image an audio source is inserted:
For stereo both channels need a separate circuit. The headphones must be modified to have no common ground, but separate 2 wires to each headphone speaker.
One may understand easily that in the 1st circuit the unwanted output from the phones cannot cause anything to be recorded. But how that situation stays in the 2nd circuit may seem not so clear. The trick is the superposition principle of the mathematical circuit theory. The audio source considered as a voltage source is worth a zero ohm wire for all outputs from the headphones.
The recorder can get too much signal from the headphone feeding capable audio source. You attenuate the signal simply by adding the 5th resistor in parallel with the recorder input. R2 and R4 must be small enough to allow enough listening volume to the headphones.
You must know the signal levels and be able to do elementary resistance and voltage division calculations to select good resistors.
As an example we can assume you have low cost headphones with nominal impedance = 30 ohms. Then you can have resistors R2=R4=15 ohms and R1=R3=1000 ohms. The internal series resistance of the audio output is assumed to be =0. If there was say 5 ohms, you should have R4 = 10 ohms.
With these selections you lose 50% of the headphone signal voltage and the high impedance audio recorder input gets about the same voltage as your headphones. If we assume it overdrives the audio recorder, add a resistor in parallel with the recording input. Resistor 500 ohms drops the recorder input voltage about 50% (=6dB), 56 ohms drops it 90% (=20dB)
NOTE1: If the audio source happens to have some internal series resistance (there very likely is), compensate it by selecting just that amount smaller R4. That series resistance probably cannot be seen nor measured directly, but one can decide it indirectly by measuring how much the output voltage drops when comparing no-load voltage and known load resistance voltage.
To balance the bridge one can also insert an adjustable resistor in place of R1,R2,R3 or R4 and search the best attenuation for the unwanted outputs from the headphones. A linear potentiometer or trimpot can be at the same time both R1 and R3.
NOTE2: This circuit cannot work if your audio output and the recorder input cannot have a common ground. I guess you do not have this problem because your system has stayed alive in your earlier attempts.