Resolving thermomechanical coupling in two and three dimensions: spontaneous strain localization owing to shear heating