I install a lot of baseboard and trim (I’m reinstalling some base after hardwood refinishing right now).
I’m sorry but mist likely you just did not nail the trim properly. My guess is your nails were not long enough or did not hit anything substantial. Expansion due to temperature / humidity / goblins should not make a difference.
Nails for trim should be minimum 1½" but 2" is best. To hold properly 2/3 of the nail should be imbedded in the substrate. For trim you need to ¾" just for the trim, ½" or more for drywall /mud before you even hit framing. Whether youbpiloted the hole in the trim has little to nothing to do with how well it holds.
Another possibility is that the wall itself is moving or being agitated by something. Even then, if trim is properly fastened it shouldn matter. It is common practice in carpentry to use glue when you really want a joint to not move.
Despite your missconceptions about glue the simplest solution is to go grab a sqeeze tube of NoMoreNails and stick the faulty piece on for good. It is thick like toothpaste and water clean up. If you can brush your teeth without making a mess you will be fine. If not you may have to spend ½ second with a damp rag to clean up.
Edited to fix fractions not showing.