Hmm… that demo is run in CI, and works locally for me with the same versions. Not sure what’s happening. Did you actually clone the demo? If you just duplicated it, make sure the hook is executable.
Assuming I understand correctly, it has less to do with the location of the snapcraft.yaml and more to do with the location of the hooks themselves.
Referring to the docs, there are two ways to tell snapcraft to put hooks into your snap:
Putting them in <root>/snap/hooks/
Build your hooks as parts and install them into <snap>/snap/hooks/
It appears you’re trying to do (1), but you didn’t follow that directory layout in the first rendition. Only in the second did you conform to the necessary convention.