The ‘Project – Manager (Auto)’ Access Right will appear under that specific resource while he is set as PM on any existing project on the system, regardless of being active or inactive. The licensing functionality is working as design. A resource which at some point was appointed manager will get the ‘Project - Manager (Auto)’ Access right.
The Manager Auto license will always be attached to the resource even if the project has been deactivated. If you do not require a resource assigning the manager auto right, because it is no longer a Project Manager on an active project and only inactive ones, you might want to assign a dummy project manager to inactive projects therefore, the license is released from the resource that was the Project Manager while the project was active.
For historical data purposes you could create a custom field that can be populated with the original Project Manager once the project is deactivated.