Improve locking in zone_maintenance()
Thread sanitizer reported a data race involving a zone timer, because zone_maintenance() was not careful about consistently locking the zone when accessing its timers. Fix this by adding a helper function that locks the zone while checking one of its timers, and adjust zone_maintenance() to use it where appropriate, and to access other zone properties under a lock.
Closes #4135 (closed)