So in Home Assistant you can create virtual switches (Helpers → Create Toggle) and under “Each time Home Assistant starts” you have three options: “Restore previous state”, “Turn on” or “Turn off”. This allows you to decide for yourself depending on the use case.
A virtual timer can also be created (Helpers → Create Timer) and here too you can choose whether or not to activate the option “Restore state and time when Home Assistant starts”.
In the current version of Home Assistant you can also see during a restart whether automations are still running that your restart would interrupt, and you can decide whether to restart immediately or later.
The virtual switches can then be passed on to Apple or Aqara Home via a virtual Matter bridge. But I believe the timer cannot be shared via Matter. I think there is no suitable cluster for it, right?
Otherwise it is very practical to be able to pass on such a virtual switch. For example, I use this with the car. An iPhone Shortcut turns a switch on when connecting to CarPlay and off when disconnecting. So in Home Assistant I can see who is currently in the car.
In this case restoring the switch state is certainly the most sensible choice, because the probability that HA fails or restarts right when the iPhone connects or disconnects from CarPlay is quite low. However, that does not rule out incorrect states occurring. For instance, if the switch is active, HA restarts, and the Shortcut executes upon CarPlay disconnect at that exact moment, the virtual switch remains active. The state would correct itself at the latest with the next disconnect.
Had the setting been chosen so that the switch turns off after a restart, the error would already be corrected the next time CarPlay connects. But in HA it would look as though the person is not currently driving the car, even though they still are. And the likelihood of HA restarting while you are driving is also higher.
So you can see that such problems can be handled in different ways, but it is difficult to rule out errors entirely. It makes sense to weigh the probabilities. For example, not setting the switch to on after a restart when a restart is most likely to happen while you are not in the car, which would basically set the “driver status” to currently “driving”.