I noticed recently that specifying the compression_level in a pkg_tar target that specified a tar.xz extension had no effect. Looking at the code, this makes sense; the xz compression path in tar_writer.py does not take into account the compression_level parameter (https://github.com/bazelbuild/rules_pkg/blob/main/pkg/private/tar/tar_writer.py#L92).
It looks like the fix here would be pretty straightforward - we either add the compression level to the command line invocation when using the xz command line utility, or we set the preset keyword argument in the tarfile.open invocation if our version of python3 supports lzma (https://docs.python.org/3/library/tarfile.html).