Access EntityEmbedFilter process function in a preprocessor
Considering letting Drupal do the work for you. Instead of calling things yourself, just let Drupal render it for you using a specific text format, which is configured to use entity embed.

See how check_markup() works, you could call that, but since you seem to be in a context where you want a render array anyway, just do what it does and use #type processed_text with #type and #format.

If that is for some reason not possible, then you need to mark the resulting object as a safe string by wrapping it with an object that implements MarkupInterface, for example with Markup::create() although that is marked as internal.