Yes, I noticed this too when specifically listening to an audio book. When the phone is unlocked the spatial audio reacts with one's head movement but when it locks (automatically or on purpose) the sound instantly "centers" and doesn't react to head movement anymore. However, this only happens occasionally when listening to music when the music is using the "Spatialize Stereo" function (when it is playing a Dolby Atmos specific format track, it is always on). When you lock the phone and put it in your pocket while listening to music, it still uses spatialized audio. It makes no sense to me why Apple did this for music but not for audio books (or other media?).
I'm hoping a future update will give the option to keep spatialized audio on or off while the phone is locked or not. In the meantime, I have to turn my autolock to "never" if I want to listen to spatialized audio books, which just drains the battery. Booo!