Connecting DAC to line out and headphones
Well you're in luck, as no one will ever be able to listen to both the headphones and the line out at the same time. 

How exactly do you envision someone listening to the line out?  The signal is unamplified and not suitable to drive some sort of electric-to-human adapter like, well, headphones.  Let's say you hook up headphones to your line out anyway.  Aside from loading and distorting the signal, the poor quality result that is also feeding the headphone amplifier will be, well, amplified and totally down out whatever sound was coming directly and unaided from the raw line out signal, if it was ever audible at all. 

To put it bluntly: it doesn't matter.  The situation you posit can't happen.

Unless you're actually imagining a very different scenario than the one you're describing.  Maybe you're imagining a performer listening on headphones while a venue's PA system is blasting the sound from the line out? Or maybe just a humble home stereo system?

Nowhere in those scenarios is anyone listening to the headphone signal and the line out signal.  Is the line out driving a giant PA system? Or living room speakers? No, of course not. It can't.  The line out is doing the same thing it is already doing with your headphones - the line out is going to get fed into an amplifier.  Because it cannot be heard by humans if it isn't.  And who knows what signal chain awaits our poor line out.  Is it fed directly into a power amp that drives some hard hitting cochlear cannons? Or is it gently fed into a preamp, and maybe a second preamp because reasons, and then finally into a distribution amp that feeds 10 power amps across an entire field?  Or maybe it's driving a stepper motor driver to make a dot matrix printer drop a sick bass line.  

And someone is also monitoring all that over that headphone jack.

Your line out at best is going to also go through some other inverting amp if it is going to ever be audible. It will be potentially inverted and reverted several times before it actually gets turned into sound waves.  There is literally nothing useful you can do about this.

Oh, and this is ignoring that the sound will always be out of phase with the headphones because waves that originate from different spatial locations will never be in phase .  And likewise, they'll never really be perfectly out of phase m.  Like that's just how sound works, and our brains have no problems dealing with all that nonsense on a nearly perpetual basis. 

And even ignoring all those points still, if it sounds weird, they can just swap the polarity of the wires driving the speaker or whatever the line out is feeding and boom - it's phase is now 180 degrees flipped.

And one closing thought, it's relative phase that matters to our brains when it comes to stereo anyway.  As long as the phase between the two channels is right, hearing the same two channels out of phase but correct relative stereo phase doesn't even matter.

In closing, you don't actually have a problem.  The best kind of problems are the ones that aren't!