You need to watch my free lectures on the valuation of securities, because this is all explained there!!
It is the investors who determine the market value of debt, and therefore we use the before-tax cost of debt, because it is the company and not the investors who get the benefit of tax relief on the debt.
The lectures are a complete free course for Paper F9 and cover everything needed to be able to pass the exam well.