Royalties are a thing in the game industry, not universal or even the norm, but they do exist.
I mean, they do everything they can to screw employees out of them using Hollywood-style accounting, but it is incorrect to say "No employee at a company ever received royalty for the code they write for the company".