The Japanese automakers have really worked hard to make their manufacturing lines (and vehicle designs) modular (a line that makes Camrys on Monday can make RAV4s on Tuesday), the foreign automakers' sedan sales didn't slip nearly as badly as the domestic automakers did so a lot of their plants/lines are still profitable to operate, and the US has always been uniquely interested in trucks and SUVs so many of the foreign-owned plants here were already optimized for SUVs (e.g the BMW plant in America has made SUVs since its inception).