Ok, yes I see that now, and I can reproduce. I tried entering this text in a new buffer (with ^H meaning a literal CTRL+H character):
g/^H/while getline('.') =~ '[^^H]^H' | s/[^^H]^H//g | endwhile
Yanking with yy or with 0y$ and running :@0 gives:
E33: No previous substitute regular expression
E476: Invalid command
To debug, I did:
:debug @0
and saw that the command actually being executed is:
g/while getline('.') =~ '[' | s/[//g | endwhile
It looks like executing :@0 is for some reason interpreting the characters as if typed. I don't know if this is intentional or not, but it's easy enough to fix by inserting literal ^V characters before the ^H characters before yanking.
I would expect this to be necessary to run a macro with @0 in normal mode, because those ^V characters will be in the macro if you record it. But I wasn't expecting it in the ex-mode command.
Especially, since :@: works on this command, and :reg : shows the contents as NOT including any ^V characters.