operating elecromagnet with 18650 cells
my original idea was to use four cells in series to a pcb and then a
  buckboost to drop to 12v to run the electromagnets. is this a viable
  option, if not what should be done differently?


This is a viable option for sure. 

The buck-boost regulator will allow the battery voltage to drop to a minimum of circa 2.7 before the batteries need recharging as well as dropping higher battery voltages to 12 volts. You might also consider that a DC electromagnet running from 12 volts wastes a lot of power if it has padding resistors to to set the current. In other words there may be more efficient winding regimes that out-perform what you may be considering and allow a running voltage as low as 6 volts or less.

You also need to keep an eye on the voltage of each 18650 cell to ensure that one hasn't reached it lower discharge limit before the other three. This can be done with differential amplifiers that measure each battery's voltage.

If one (at least) reaches the lower limit, the discharge process must be stopped to prevent possible cell damage.

I don't know what output current your load will take but here's one that works from 9 volts to 15 volts and can supply up to 3 amps. It also has an undervoltage lockout that switches off the output should the input voltage drop below 8.5 volts (set by the two resistors that attach to the RUN pin): -