How did Bottas unlap himself with the current blue flag rules?

He was lapped when the first safety car came out, but the rules stipulate that lapped cars get to regain that lap under safety car before a restart.

Sporting Regulation

39.12

If the clerk of the course considers it safe to do so, and the message "LAPPED CARS MAY NOW OVERTAKE" has been sent to all teams via the official messaging system, any cars that have been lapped by the leader will be required to pass the cars on the lead lap and the safety car.

This will only apply to cars that were lapped at the time they crossed the Line at the end of the lap during which they crossed the first Safety Car line for the second time after the safety car was deployed.

Having overtaken the cars on the lead lap and the safety car these cars should then proceed around the track at an appropriate speed, without overtaking, and make every effort to take up position at the back of the line of cars behind the safety car.

After that first restart Bottas was still quite a long way back from the cars on the lead lap.

But that is how he got himself on the lead lap.

Then another safety car can out almost immediately and that is how he caught up with the field.

/r/formula1 Thread