One of the companies I worked for put into their employment agreement language that stated they owned all the code I had written before starting work for them. It was the most hilarious overreach I've ever seen in an employment agreement - but then companies can put literally anything they want into the agreements, and they aren't worth shit anyway.
I told them this was utterly ridiculous and edited the agreement to remove this and some other nonsense before signing it, and they hired me anyway.