I solved it. This was one of the most weirdest problems that I have ever came across!
Previously, I used an iBall roouter, and it had an SSID "XAVIER-WIFI"
After I bought the new Dlink router, I gave this new router the same SSID "XAVIER-WIFI"
After that, all the new devices had no problems in connecting to the new router (they were oblivious to the change of routers I think)
But this problem of DHCP remained.
So finally, I thought of changing the SSID (I don't know why I thought about this) and voila! DHCP is working. However, before this, I did a factory reset.
It's a weird problem with an even weirder solution!
Thanks for all the help. Notify the devs about this bug.