As @ccstone says, KM8 does indeed now allow for keystrokes to be sent to apps in the background: https://wiki.keyboardmaestro.com/action/Type_a_Keystroke
But as the page says, since most apps don't expect to receive input in the background, how well it works in practice could vary drastically.
The only way to truly ensure that your macros don't interfere with your own ability to use your Mac is to write them in such a way that they don't depend on simulated UI interactions like keystrokes and mouse clicks, which usually means resorting to scripting. Depending on how familiar you are with scripting this can feel like a tall hurdle to overcome, but as someone new to it myself, I can tell you that even a little knowledge can go a long way towards the kind of automation you describe.
As an example, here's an old version of a macro I used to use frequently that would manually copy text from BBEdit, paste it into Excel, and switch back to BBEdit:
This macro saved me a lot of time and manual typing, but it was also prone to errors, usually when Excel would be slow to activate and throw off the rest of the macro, and even when it worked correctly it prevented me from working in BBEdit while it was running. I imagine this is not unlike the scenarios you've been running into yourself.
By comparison, here's the macro I use now:
As you can see, the initial steps are unchanged, but the latter half has been entirely replaced by an AppleScript that is faster and more precise then the old macro ever was, and it doesn't interfere with my own use of my Mac at all beyond the initial copy and forward delete actions (which are so quick that I couldn't interfere with them even if I wanted to anyway) thus letting me continue to use BBEdit even as the data in the Excel document changes. While this version admittedly took a lot more reading and experimenting to set up properly than the old one, it has also more than paid that effort off in how much better it works.
Hopefully this gives you an idea of how scripting can help you to better automate your Mac like the way you describe. If, like me, you've also never dabbled much in AppleScript before and aren't sure where to begin, I would point you towards @ccstone's own References for Learning & Using AppleScript and encourage you to ask questions here, as there are several experienced scripters here whose expertise far surpasses my own and have been incredibly helpful in providing assistance and in-depth examples (such as @JMichaelTX, who just recently demonstrated how to use AppleScript to safely delete a sequence of macro actions).