All of the license-encumbered code lives in a separate directory, with a clear warning that it's licensed, and builds result in license-encumbered code being an entirely separate artifact from the purely Apache 2 licensed code. Besides that, anything that goes into package managers is also fully clean Apache 2 licensed code.
Literally the only way to "mix this up" is to not read anything, ignore package managers and build from source, then somehow decide to use 'x-pack' over 'elasticsearch'.