Unfortunately it seems that for some users, this headphone adapter isn’t working. According to some user reports, Pixel 2 and Pixel 2 XL owners are claiming that the bundled headphone jack aren’t working for them. The reports are claiming that when plugged in, it’s as if the headphone adapter isn’t recognized and sound continues to come from the phone’s speakers as opposed as through the headphones.
Oddly enough it seems that it might not necessarily be a hardware issue because according to some users, rebooting the phone fixes the problem. Google is also recommending that users try restarting their phones and booting it into safe mode to prevent other apps from potentially interfering with it, but as Android Police points out, having to boot a phone into safe mode just to listen to music seems a tad inconvenient.
In any case it is unclear as to what exactly could be the cause of the problem, and it is possible that for some users, the adapter could indeed be at fault. Google is offering replacements for those who are facing these issues, so maybe you could try getting a new adapter if this problem persists.