In the case of service invention, the intellectual property belongs to the company, but the company should give certain rewards to employees.
In your story, Guo completed the program with his own personal resources. And changing the program has nothing to do with the work arranged by the company and cannot be regarded as a service invention. Intellectual property rights should belong to Guo.
Guo didn't apply for a patent immediately, but also copied the program to others, which was very stupid.
Because there is no intellectual property owner, it is difficult to hold Lu responsible for using the software without authorization.
If Lu (or Y company) gets the patent first, it will be difficult for Guo to safeguard his rights and interests.
Guo should immediately apply for a patent change procedure.
After the application, notify the company where Lu is located in writing to stop using the software immediately, or resort to law!