Detect Displays sets default wallpaper
OS X saves unique wallpaper settings on a per-device (per-monitor) basis. The wallpaper setting you make when using only your laptop, vs. the wallpaper setting when you run the laptop in "Clamshell mode", vs. the wallpaper setting when you run with the lid open and external monitor connected, all have different wallpaper settings.

The solution to this problem is quite simply to run your computer in dual-monitor mode as you've listed, and configure your wallpaper settings. Now those specific settings will be remembered when you are running the same external monitor and built-in laptop screen configuration. Changes to this multi-monitor mode will not affect the other monitor configurations.