regardless if the pilot thought the traveler was a non-rev, the pilots or flight attendants are not given the right to make sure non-rev dress codes are followed. That policy is given to the gate agent.
And starting October 1, the dress code on UA basically goes away for non-rev travel as it merges with the current CO dress code. (however, track suits from GLEE are still not allowed)