For most contractual agreements you assign copy-write of your work to your employer. So if you used your personal project in work for your employer the copy-write becomes theirs.
My guess is that in your hypothetical scenario the first company would own the IP and could sue the worker or other company for infringement.
My guess is that in your hypothetical scenario the first company would own the IP and could sue the worker or other company for infringement.