Two things to consider here.
First, the Stormbreaker blow, while obviously very powerful, was not an insta-kill for someone as strong as Thanos (who's already powerful with or without Stones). Hence Thanos' line about how Thor "should have gone for the head". The slight delay between the blow and the resulting death, if not dealt with, allowed Thanos to snap.
Obviously the most likely that happened after that is that Thanos combined snapping half life in the universe with self-healing. The Time Stone can probably do that, as it managed to bring Vision back to life.
Not only is it likely, it actually fits well into Thanos' plans: if he allows himself to die, with the Stones still around, anyone1 can erase what he just did. To ensure this doesn't happen, he has to be able to protect the Stones, and later destroy them, as we see in Endgame. Note that the destruction seemed to take a great deal of effort, which once again wouldn't have been possible if Thanos hadn't first ensured he got healed.
Note that as mentioned in TheLethalCarrot's answer, that healing didn't occur exactly while snapping, but possibly a tad bit after. In either case, Thanos still has to make sure he's fit for what happens next. It's possible he recovered without using the Time Stone, though he had good reasons to.
1 Well, not anyone, but almost every superpowered hero in the MCU is located in a one-mile radius, and they're the most likely candidates.