Some lubricants can do that. Barricade is an excellent example. It will, over a relatively short time, become thick like a grease, on the surface of your gun. I think the manufacturers intended it to be that way because it is an excellent rust preventive for long storage. The thickening will start to take place over a period of about week and by 2 or 3 weeks it will have become like a grease. It's good stuff but you have to know that it does this and take care to wipe it all away before taking your gun our to shoot it.
There are other lubricants that have some kind of volatile additives that will slowly evaporate and the lubricant will become thickened. I can't think of a good example right now but I have had some small cans of lubricant that did sit in the can for a loooong time (years) and became a thickened goo inside the can. Some of this thickening of lubricants can be caused by polymerization. I don't know all of the conditions to which a can of lubricant would have to be subjected to cause it to become polymerized but I would put time and heat into the equation.
I have never heard of light machine oils such as 3 in One thickening. That is not the only brand of light machine oil that is a really good oil for guns and contains a rust inhibitor. That is the kind of oil I would pick for my guns. If I am going to let them sit in my gun safe for a long time (months or years) I would use something like Barricade or RIG. If you use something like one of these, just be sure to wipe out all of it using a solvent such as mineral spirits, kerosene, etc. before taking it out to shoot.