Office Word had an option to automate repeated actions. I haven’t used Word in years but I assume it still has that option.
Your recent video “3 Ways to Automate Keystrokes” doesn’t allow using mouse actions. I used to create Macros in Word to automate word processing documents for margins, font changes, text colors, etc. I have a series of mouse actions that I do every time I download text from the web to a Pages document. It would be a better use of my time to be able to automate it but I have not found a way to do that in Pages. I don’t think it’s possible to set up some of these actions using only the keyboard.