Hierarchy collapses whenever I build the game

I have my hierarchy quite organized, and many times I am working quite deep down on objects down the hierarchy.

Whenever I make a build to go see how the game looks in a proper build, the whole hierarchy gets collapsed and to resume work I have to manually go expand each game object until Im back where I was working on

Same thing happens when changing layout

This is getting old quite fast, having to go down the hierarchy every time is starting to be really annoying, is there a way to avoid this behaviour?

Thanks