Datasheet, Datasheet, Datasheet!!!!!

Really.... you gotta get this tatooed in some prominent place...

Walk with me on this one...

GPIO.2 is also the T0CKI pin...

Table 6-1 on Page 34 Reference Note (3) at the bottom states "The TRIS of the T0CKI pin is over-ridden when T0CKS=1". There's also a great-big NOTE to this effect at the top of Page 22!

T0CKS is part of the OPTION REGISTER.

See Register 4-3 on Page 22 and cross-reference this with Table 7-3 (Reset Conditions) on Page 44... you will note that this register bit is set to '1' on Power-up, therefore TRISIO is over-ridden...

So set OPTION_REG.5=0 before your TRISIO statement.