Port api.detach_state to aarch64 and fix any bugs it finds
Xref #4474 on bridging the testing gap. Xref #1578 on detach on arm and some bugs already found and fixed there to get api.detach working. But api.startstop and several other tests still have crashes or hangs. This issue is about getting api.detach_state ported to aarch64 which may find bugs at the point of occurence that fix the other tests where the symptoms are downstream.