So the problem is that it doesn’t matter what causes the insomnia in the first instance.
If you’ve had the sleep problem for a short period of time, then realise you have a hormone imbalance but you can regulate it, then your sleep may improve.
However, if it’s a chronic problem that you’ve had for many months or years, then even if it was an imbalance of hormones that caused it, unfortunately your brain has remembered how to sleep this way. Fixing a chemical or hormonal imbalance is not going to suddenly stop your brain from learning a new pattern.