I think this behavior can be changed in System Settings > Desktop & Dock > Automatically Rearrange Spaces based on most recent use (turn it off)