Let the Java JSON Formatter handle output and embeddings in hooks

https://github.com/cucumber/cucumber-jvm/issues/638 showed that the Java JSON Formatter does not handle output and embeddings in hooks properly (that is calls to cucumber.api.scenario.write() and cucumber.api.scenario.embed() in hooks). This PR should fix this.