#27997 but for Script parsing.
I've added a test demonstrating the behaviour despite the descriptor parsing also currently being incorrect (wsh(raw()), see #28067). I guess whichever comes after the other between this PR and #28067 would be trivial to rebase on to fix it.