You’re focused on using this and needing documentation on this, when all you really need to know is that this is a state object and the state object documentation covers it.
IIRC, the only way a state objects last_changed is a string is if HA just restarted. I was also under the impression that they’d convert it to a datetime for you.
{% set last_changed = this.last_changed if this.last_changed is not string else this.last_changed | as_datetime %}
{% set cur_state_age = (now() - last_changed).total_seconds() | int %}