By default, when you go to change the color profile (or color space) of a document in Photoshop, it will flatten all the layers. If that’s not what you want, there’s a really simple fix. But it’s not one that exactly leaps out at you, unless you know it’s there.
When you go to convert your color profile from, say, AdobeRGB to sRGB or from AdobeRGB to ProPhoto, you’re given several options on the popup screen. (Save your file first, then Edit > Convert to Profile)
The very bottom option option is “Flatten Image to Preserve Appearance.” By default, it’s checked. Uncheck that to stop the layers from flattening during the color profile conversion.
You’ll then get another popup, this one asking whether you want to rasterize the smart objects. This really depends on how complicated your smart objects are, but for simple smart objects the “Don’t Rasterize” option works well.
And that’s it. As I said, it’s not complicated, but it’s much easier if you know that the option exists.