First law of compact binary mechanics with gravitational-wave tails