#76302Fix output and inconsistencies in DebugUtility
Description
The DebugUtility always was and still is a crude mixture of methods, which creates debug output for different targets.
This never worked properly, but got even worse with the refactoring of the backend debugging console #65956
Since then the output of objects and array in a different context is so ugly and unusable, that it can considered broken (the result of json_encode of an object is not really helpful for a human).
Besides that, the context check is broken since a while, so that still HTML is shown in CLI context.
Last but not least, when outputting HTML, proper encoding is missing in most of the places.