Everyone has a price, and I assume Bytedance knows how valuable having a former DoD spokesman as their PR guy is - especially in this new environment of geopolitical realism. Whatever that price was, I think it's safe to assume it was met.
In the same vein, Michael Flynn went from being a US Army lieutenant general to a foreign agent lobbying for governments like Turkey.
I think there was a law against that.
A job's a job. A DOD spokesperson isn't receiving any confidential information. Their job is political, just as it would be at Facebook, if they chose to work there.