I would humbly suggest you're overthinking the solution to this problem. Surely, it would make more sense to set the keyboard shortcut you want for toggling DND in System Preferences > Keyboard > Shortcuts and let macOS handle it?
The full macro I want to create would include: enable another app (also by using Type keystroke and it is working just fine), turn on DND, pause 25 minutes, disable other app and turn off DND
Turn on and off DND is the only part I couldn’t solve at the moment.
FWIW I have made toggling DND = HyperKey + D (so command+option+control+shift+D) and Keyboard Maestro can easily emulate that keystroke in another macro, so maybe try a different key combination?
I would first follow tjlouma's suggestion to try an alternate shortcut. If that makes no difference, it could be that in your full macro a pause is needed between the application launch and the activation of Do Not Disturb. The pause doesn't necessarily need to be long, maybe just a few seconds or until the app that was launched has completed its launch process.