The dispute between the NSW government and rail unions is returning to court in the wake of thousands of services being cancelled or delayed.