Weight gain or loss definitely has a very significant psychological aspect, and it is a million times easier to lose weight when feeling positive generally (unless you are one of the people who loses their apoetite and can't eat when stressed and overwhelmed - people generally either lose or gain weight when under significant long term stress and crucially when feeling overwhelmed and helpless or lacking control, rather than positively engaged with solving an issue they believe that they have some control over.
I gained a lot of weight between 2010/11 and 2020, and a chain of fairly stressful and difficult situations cleared up with a positive outcome for me in July 2020.
That put me in the right headspace to lose weight, and I've lost 5 and a half stone (35kg) since then.
Lockdown adds some stresses (homeschooling and a higher workload at work) but removes others (juggling ferrying 3 kids to separate extra curriculars and friends houses around shift work, extended family obligations involving travel) and I do a job which cannot be done from home, so still go to work - more than before actually as the workload has increased and there are staffing issues.
You definitely need to be in a pisitive mindset to lose weight - its why fatshaming is a vicious cycle and doesn't work. Losing weight is both incredibly easy and incredibly difficult, because we all know how to do it, but actually doing it is impossible until your attitude is positive long term, and that's easier said than done.
There's definitely no need for gyms to be open in order to lose weight - all I do is walk daily for between 45 minutes and 3 hours depending on shifts and homeschooling etc etc. Obviously food is key. When feeling overwhelmed its normal to make excuses and self sabotage - the psychological aspect is absolutely central and very hard to change just through sheer force of will.
Good luck.