Also today there is no foolproof encryption if you make misstakes (or if an unknow attacker knows more about math than you do, or made a working quantum computer)

And what nazi germany could have done back then, to not have it broken would have been very simple: not using prussian style of communication, meaning all the messages followed a certain pattern with certain keywords. Since the british knew those keywords and pattern, they had something of an angle to break it. (Parts of it are covered in the article)

Or of course use another layer of encryption (but that requires a simple redesign) which would have made the decryption not useful in a timely manner.