libathemecore: modernize hook system

Use mowgli-2 features, avoid creating dynamic objects, and fix a potential
memory leak as well.
libathemecore: add stop/continue functions