On https://research.swtch.com/zip there is a description of socalled "lz quines", LZ-archives that when extracted manually just expand to themselves. The page also provides actual examples for gz, tar.gz and even zip files.
Does some know of corresponding examples for other algorithms/formats too, in particular for bzip2 and xz (maybe even for 7z containers using either of lzma or ppmd compression).
I think it should be possible with lzma2, but likely not BWT/PPM.
An example:
#include <stdio.h>
char*s="#include <stdio.h>%cchar*s=%c%s%c;%cint main(void){printf(s,10,34,s,34,10,10);}%c";
int main(void){printf(s,10,34,s,34,10,10);}
Same method is used to generate an archive - you need 2+ different methods to encode data and reference previous data,
which don't really exist in BWT/PPM.
And lzma is not 100% impossible, but you'd have a hard time adjusting it, while the whole code changes from any modification.