WHT isn't there a simple way to restore previous state in automations

I would love to see simple ways to capture and restore devices’ previous states. For example, within automation, it would be nice to have an action that “Capture current state of [Area, Device, Entitie], assign that state a name” and then a subsequent action to “Restore [name] state.”

You can do this with run-time created scenes?