You remember my recommendations for a programmer if the management is weak and stupid, right? Don't be loyal. Instead, use their resources for your own good. But what do you do if you are the architect and the tech lead of the project? In that case, the situation is more complicated, but it's solvable. You just need to be more careful, here is how.
The full video is here: https://www.youtube.com/watch?v=_Y2lZsRLwlk