When I read this, I think of something related to myself. I get heartburn whenever I eat pasta with red sauce. But I love it. It's worth it. So, I just prepare. I take a tagamet or pepcid tablet as soon as I eat it. ??
I don't know if it's an allergy, but there are enzymes and proteins in semen that may be irritating your mucus membranes in your digestive tract somewhere, causing this.
There are some things you can do to help with heartburn - https://www.healthline.com/health/gerd/heartburn-relief#loosen-clothing
These are all things for after, of course, and not to prevent. If you can safely take things like Pepcid, maybe take one before and see if that helps.
If there are other times you get heartburn, then talk to your doctor. It might be a sign of reflux, and not just heartburn.