As you already realized, ~ないといけない is a set phrase for duty, as same as ~なくてはいけない, ~なくてはならない, ~なければいけない, ~なければならない, and the contracted versions ~なくちゃいけない/ならない and ~なきゃいけない/ならない. (~ないとならない is rarely used.)
~ないと, ~なくては and ~なければ are all conditionals "if not", so the meaning "must/have to" of these idioms is from "if not, that's not good". You'll come across the omitted versions ~なくちゃ or ~なきゃ, meaning "I should do" or "you should do", at the end of a sentence in colloquial conversations.