I can see both sides of the argument. They’re probably saying that when the hospital order was quashed the parasitical aftercare duties died with it. But since the patient was “admitted to a hospital in pursuance of a hospital order made under section 37” and did “cease to be detained and … leave hospital”, I think the question now is the usual s117 question of whether “the person concerned is no longer in need of such services”.
There are similarities with the question here: Invalid section 3 and S117 aftercare.