yep, that's totally doable.
However, since you want to be able to adapt at any point, the simple "add newest, subtract oldest sample from sum" approach to moving averages might no longer work (you'd need to be able to subtract or add more or fewer samples on the fly, which might require you to recalculate the whole sum, within one sample). At that point, the MA loses its computational advantage.
If so, how can I switch between different window sizes without causing spikes in filtered data or abrupt changes in the rate of the smoothed data?
Interpolate between the old and the new filter impulse response, and cycle through the interpolated filters slowly enough for you to avoid what you define to be a spike. You can't mathematically have "no abrupt change" but "abruptly change". That's the point where your Moving Average really needs to be treated as any other direct form FIR filter.
So: why a moving average? Unless you're really looking for a filter with a sinc spectrum, that's rarely the most adequate smoothing filter. And through your interpolation requirements, you lose most of the computational advantage of a simple moving average implementation.