It reads like the “if” clause only pertains to the second “every”, but it also applies to the first. In this instance it doesn’t make a real difference, but presumably the Englishfier doesn’t know that.
It is correct, but a lot wordier than "At midnight on the first Monday of every month."