Is it safe to buy a router if its serial number and other details are exposed on the web?
Yes this is safe.
- Default password and PIN are irrelevant if you change them (or replace the firmware.)
- Serial number is irrelevant anyway.
- Part number is irrelevant anyway.
Which leaves the MAC address. With some routers this is used to compute a default password, but once you change this I don't believe there is any risk.
The biggest risk of any router is the potential presence of backdoors that the manufacturer firmware may contain, but given that you are replacing it with DD-WRT that does not matter.
As long as you change the default password that shouldn't be a problem. I would recommend you to deactivate WPS though.