Umm, the ON CONNECT doesn't trigger at the TCP socket connection, but after it's done the USER and the initial NICK.

One assumes that all the automated 'server' settings should be finished prior to being able to change values that they rely upon.