Keep map layers when switching to online map and back to offline map

Sorry, this is not possible.

The map layers are automatically provided by the map style.
And each map style can have different layers (e.g. see here).