I’ve noticed a strange problem on my MacBook Pro where the Finder wouldn’t bring its windows to the front when I click on it in the dock and ‘bring all to front’ didn’t work in any application. For a while I thought one of my login items or extensions was responsible for it. When I logged in as a different user, everything worked normally.
It turns out the problem is caused by turning off the option ‘When switching to an application, switch to a space with open windows…’ option in the Spaces preferences. Once I turned it back on, everything started working normally.