Speakers and headphone jack with I2S input

Exactly what you want is already available: Kopfhörerplatine basierend auf MS6324 und TDA1308 bzw. LM4808M.
It makes use of a headphone jack „pj-306b“ which features an integrated switch (in fact it’s two of them) that I use to pull HP_DETECT to GND in order to let ESPuino if headphones are plugged in. That means: normally HP_DETECT is high and will be pulled down to GND if headphones are plugged in. With DETECT_HP_ON_HIGH you can invert this behaviour.

We already used MS6324, UDA1334 and PCM5102 for such purposes, but others might work as well. You need to make sure to use an amp because otherwise it’s not powerful enough.