Ultimately it's a results business, if Spain do ok, say a semi-final spot minimum, the federation president is going to be hailed as a strong, decisive leader. Crash out in the group and it's all his fault, putting ego over national interest etc etc...
On its own, it's a fair decision. You set certain lines, a guy crosses them, you have to follow through otherwise you lose authority and lessen the chances of you being able to do your job well. Clearly the Spanish federation believe Lopetegui was negotiating for a much longer time behind their backs, broke the trust, crossed the line out you go.