How to DIY BaoFeng radio-to-soundcard cable?
It looks like somebody solved the exact problem you are mentioning, and it requires an intermediate board between the sound card and the radio. Here is the suggested pinout:

The original article can be found on https://k0rx.com/blog/2017/11/baofeng.html, but I copied the image in case it goes offline.
It is equally interesting to mention a solution which does not work: Basically, plain wiring of the appropriate cables to the input and output of your sound card will not do the trick if the sound card puts the grounds together, because shorting the sleeves is how you cause the PTT to transmit.
Now this isn't always the case, because I found somebody who put a cable together by cutting a double male jack, a 2-pins cable and doing some very simple soldering:

However, I suspect that the fact it works is specific to the sound card.
The board I mentioned seems to exist as a &quot;commercial&quot; solution (a hobbyist sells those on ebay). I won't paste an ebay link here as I suspect this is against the community policy, but here is a picture of it and it seems to be what you are looking for. I cannot recommend it myself, but this is where my own search has led me so far.

Edit: After giving it more thoughts, I figured a way to wire this without shorting the sleeves. When the PTT is open, you get the correct GND for the speakers. When the PTT is closed, MIC- and SPK- have the same potential, so you get the correct GND for the MIC.

Edit 2:
I believe that is how the person from highonsolder.com did it. However, they say that they must set the in and out of the sound card to very low volume for it to function correctly. That would be because the output of the card is set to line level. In that case, a voltage divider should do the trick to attenuate the signal and set it to mic level. Here is what I intend to try: