Window switcher priority order

When I open Firefox and my windows are recovered, for the window switcher (Alt+Tab) these new windows take higher priority than any other windows. Even if I open new windows, the browser windows stay as top priority. To restore the regular behaviour, ie that Alt+Tab will switch to the most recent window, I need to give focus to each and every single Firefox window first.

Is this a Firefox bug? Is it a Gnome issue? Any workaround?