That's a good story - and I think many of us have had similar things and we learn from them.
I think it's a tricky thing - if we give them their freedom, they can't survive and have accidents and injuries and day or get caught by a predator. As domesticated pets they aren't in their natural environment so we need to tame them and give them a good habitat so they are happy in their environment. All hamsters like to roam a bit but houses aren't always safe places so people set up runs and playpen areas around the cage sometimes, or when they're tame you can let them run around on a bed or in one room that has been hamster-proofed or something.
It's why bigger cages are a good idea - it gives them more of a habitat, rather than just somewhere to sleep.
Buying toys and treats is a balance too - sometimes we give them too much when they're happy with something to dig in and a bit of hidden food to find! But anything that enriches their environment is a good thing. There was a German study that said that when hamsters have enough substrate to dig in it reduces their stress levels hugely - because hamsters are diggers by nature! They forage for nesting and food in the wild and dig tunnels and burrows to keep safe in. Scatter feeding some of his food can make his life interesting as he gets a nice surprise when he finds it in the substrate and has something to forage for.
We need to look out for our little pets. I had something similar happen with a kitten when I was a teenager - we left it outside too long and it fell in something and drowned. I cried for days.
I am sure Hamish did want to get out of his cage if it was too small and I am sure he spent many happy fun times under your wardrobe!