The European Commission said on Monday it would take legal action against Romania unless it reversed measures that undermine the independence of its courts and the fight against corruption.