Question: is there a rule about pitting for a damaged car?

Another similar incident would be Hamilton/Rosberg collision on the last lap of the Austrian GP 2016.

Rosberg was also given two penalty points on his licence, and reprimanded for completing the race with a damaged car, thereby spreading debris on the track. However, as the stewards noted: "We do note the extenuating circumstances and the fact that the driver of Car 6 (ROS) did slow down significantly and attempted to mitigate the risk to other drivers and cars."

[Formula1.com]

The main difference would be that Hamilton wasn't spreading debris on the track so not even creating the risk Rosberg "attempted to mitigate".

Also there was talk about not being allowed to finish the race in the pit lane at Silverstone due to it being shorter (also mentioned in another comment) but I haven't found a written rule regarding that.

/r/formula1 Thread Parent