Dark radiation as a probe for a phase transition in the early Universe