When the Tesla can not reliably detect lanes (for example, due to too dense traffic), it starts to just follow whatever vehicle is in front, and determines the lane from that vehicles movement.
Not always, in highway traffic the lane markings are frequently too obscured to be readable by the camera, but if it believes that the cars in front are driving in the lanes, it just uses them.
Otherwise autopilot wouldn't work at all on highways.