Entering text into another app/the first responder on macOS

Basically, as an example, say I was building a dictation app for Mac. I want the text detected to just go into whatever text field is currently highlighted/focused, but don't want those keystrokes to be detected as commands.

I know it's possible to use AppleScript together with System Events for this, but that just sends the keystrokes which could confuse certain apps, and now no longer passes App Store Review as it requires the temporary entitlement to make it work across all apps.

Passing App Store review isn't a requirement for me here but it would be nice.