See the section about Automator in this link: https://appletoolbox.com/quit-all-apps-at-the-same-time-mac/ It explains how to set up a mini-app in your dock to quickly shut down all open apps with a click.
However this is basically what your Mac tries to do when it shuts down. So if Opera is not quitting in a well-behaved way, it may also misbehave with the Automator script, you can try it to see. The issue may be a conflict between something in Opera or an extension installed in Opera and something else in the MacOS. This can be tricky to track down but a start would be to remove all Opera extensions and see if the misbehavior goes away. If it does, reinstall each extension and test again until you find the culprit.
If you have no extensions, then you may want to report this issue to Opera, they track and fix bugs.