When ever you find w3wp process attaching issues or multiple times of w3wp process
1. Please check do local service w3c loading service is running.
2. Please do check Load symbol for items in the solution.
D365 > Option
3. Restart the IIS.
Hope your issue will get resolved.
Conformation:
Thanks,