i think it's his will again and if he mixes hashi's sage mode then obito'll not be able to cancel it not this time that is how He is going to switch with obito.
Madara has Hashirama's DNA. It's obvious that Hashirama's Sage Mode is related to the Mokuton Element, and so Madara was able to achieve it by some manner.