Magnus obviously knew what he was doing
I am not a fan of Fide and detest archaic dress codes out of principle, but you have to be incredibly naive to not understand that Magnus knew what he was doing. He has played this tournament many times before knowing what the dress code consists of and was going into today with a subpar performance by his high standards - effectively ruling him out of contention of winning the rapid portion.
Choosing to breach the dress code has two outcomes, both of which benefit Magnus:
1) Fide does nothing about their admittedly stupid dress code being broken and Magnus scores a simple petty victory over their jurisdiction.
2) Fide reprimands him and he gains an excuse to nullify a bad performance and further strain his relationship with the organization. Conveniently, Magnus has competing economic interests with Fide and the more he distances himself from Fide, the freer he is to promote freestyle chess, which would benefit him financially.
This dude has spent his entire lifetime playing chess tournaments and has participated in this specific event many times, I highly doubt he simply forgot the dress code. If you disagree with the dress code in principle, do not play the event or protest after the fact - not only when you are doing poorly and are unhappy with the results.