How does a digital potentiometer work?
Second option is a good representation. You can fabricate well matched resistors in CMOS processes, and also well matched analog switches. As ever, the absolute value tolerance for passives in CMOS is high, but the matching is excellent. Have a look at the datasheet for the PGA2311, which is a audio potentiometer.

The first option would be a bit grim, as you've alluded to. The MOSFETs are non-linear, and you have issues with the bulk connection with changing \$V_\mathrm{DS}\$.