sed -e '$!{h;d;}' -e x
which could also be written as:
sed '$!{h;d;};x'

In both examples, why isn't the x executed for all lines?

for the first set of commands we say: "do this for all lines except for the last line" but the second command "x" isn't restricted to any line. It should run for every line, therefore exchanging the content of the pattern/hold buffers and printing, resulting in EVERY line except the last to be printed. Instead it's only executed for the last line.
The "-e" multiple command option or the ";" (semicolon which as far as I can tell acts the same as "-e") should work for every line unless restricted by a range operator which in this case it's not, yet it still works. WHY???