Two questions:
1) Do domestique riders go all out during time trial to save their legs for their primary duty? Is there cut off time?
2) very often I saw riders draft behind their team car to get back to the peloton, usually after some mechanical failure. Is this legal?
There is a percentage finish cut off for every stage, including time trials. Eg 110% of the winning time, so no one can go too slowly on any stage. The percentage changes depending on the stage. Mountain stages carry the most risk of lots of riders finishing outside the cut off. And there have been times when too many riders missed the cut so the rules have to be bent.
Drafting the car is a grey area, it is usually allowed if you suffered a mechanical and are trying to rejoin the peleton. You cant hold the car, and you cant draft in other situations suchs as time trials or if you were looking to bridge a gap to a breakaway. The race organisers will fine people and dock time too.