User can't change language after redirection from custom module
Now your code redirect always, and you only want to redirect once. It means you need implement logic similar to the one below:


Test $_SESSION to see if redirection evaluation took place already. If yes, end.
Create element in $_SESSION, to mark this session as already evaluated against redirection
Decide if you want to redirect or not.
Perform redirect if needed.


That way you will run code responsible for redirection once and only once per user session, and that's seems what you want to do.