Yes, you would be obligated to do the prelim year. But the only way you would get into this situation is if you put the prelim year on your primary rank list. If you only put it on your secondary rank lists, you won't match to anything if you don't match to derm.
But you can, and should, put it on your primary rank list at the bottom because matching prelim med at an academic program is far better than going unmatched because it
(1) allows you to SOAP for the 1 or 2 unfilled derm spots (or any advanced spot for that matter),
(2) allows you to apply for any derm openings throughout the prelim year,
(3) allows you to reapply for the match the next year with a good answer to "what have you been doing in the meantime?",
(4) sets you up to continue straight into a categorical IM residency without any delay
(5) allows you to apply for derm after IM residency and also offers you many fellowship choices if you don't want to do general IM
Bottom line, you put a prelim med spot on the bottom of your rank list, you are committing yourself to a year that you would have to do anyway but you are opening/leaving open many, many doors by doing this. If you only rank advanced programs on the primary list, you are severely limiting your options if you don't match.