I don't know that there's anything short-term that can really be done about this other than creating warnings in the documentation. There's a keyword conflict in the parser between loops and hooks. The result is that when you have a loop inside of a hook, it may not be immediately obvious as to what will happen. This is definitely expected behavior when you consider how everything is supposed to work... but it creates really messy code in script land.
2.4.1 on Ubuntu 14.04