Yes, the speaker is muted when you use headphones. I used this jack: https://smile.amazon.com/gp/product/B07MFKKWG5/. Here is a datasheet for a comparable jack: https://cdn-shop.adafruit.com/datasheets/STX-3100-5N.pdf.
I connected PP25 on the Pi (L Audio) to pin 2 on the jack, PP26 (R Audio) to pin 5 and PP6 (GND) to pin 1. Then PAM A+ to pin 3 on the jack and PAM A- to pin 4.
Pins 2 and 5 press against the contacts for pins 3 and 4 when the jack is empty, so signal will pass through to the amplifier and speaker. Plugging headphones into the jack will lift pins 2 and 5 away from pins 3 and 4, cutting off the signal to the amplifier and speaker.
Hope that helps, Cheers!