The solution is simple. Don't minimize windows. Everything fullscreen on virtual desktops. Three fingers up and choose the window you want if it's one you don't use normally. Three finger swipe between frequently used windows.
I do this. It's absolutely insane that it's the easiest way to do window management in MacOS. We have regressed to the point of not having windows anymore.
A while back I had the Raspberry Pi 400 computer on my desk and a newish M1 Mac. It was interesting how much better the window management was on the Pi. Frankly, for things like file management, that little computer was Snappy as hell.
And it does dual monitors like a champ!
And don't get me wrong here, I've used a lot of systems, and I'm fine with my Mac. I know how to use it, I get things done and the M1 chip is really sweet.
I generally go with the flow figure out what the flow is and I just don't worry about it past that. I just had to comment on this particular topic because I thought it was kind of humorous.
I use a variation of this approach. Make all windows exactly the same size (I'm using Hammerspoon). Hide applications (Cmd-H) instead of minimizing windows. Cmd-Tab to whatever app you want. Cmd-` to whatever window you want.
Sometimes the silly shadow around the top window gets too big, but then you can Option-Cmd-H to hide all other apps.
This is where snapping comes in. You can make a fullscreen window that is made up of two applications. Really it just comes down to never fusing with your windows once you have them set up to your liking. Once everything is either fullscreen or in its corner of a virtual desktop you should never be changing how your windows work. Nothing should ever be hidden behind anything else, if it is it's time to make a new virtual desktop for it.