A few years back I was thinking about ways to make a program that prints its own source code and I came up with these two approaches:
Is there any other algorithm a program can use to print its own source code?
I think your two cases cover all the options. Case (1) covers cases of the form "load the program source from an external device," while case (2) covers cases of the form "generate the program source programmatically." You could of course consider a hybrid approach like "read the first half of the program from a file and then generate the second half programmatically," but this doesn't seem any different from what you described above.