A strong but constant reminder that companies are not your family or friends despite what will say the corporate bullshit.
You should never invest more of your time and energy than what is expected for your position. And keep your side activities and hobbies as personal things using your personal email and accounts.
This is also why you should not owe fidelity to your company and don't hesitate to switch if you have a good opportunity because on its side the company will not hesitate.
Everything might be good and you can generate money, and still the day you are in a redundancy for whatever reason you will be worthing nothing to the company. Like that, just like a replaceable cog. And you will be badly handled because "it is the company policy and we can't do anything than being harsh in such a situation".
The worse is that usually the decision is non-sense but the one deciding is not the one that has to deal with the decision and with you. So you will try to argue, and they will try to invent reasons to rationalize the decision that is imposed on them also, you will try to contest, and they will become angry to have their bullshit called and will double down... And you will feel bad, not understand the situation.
The only thing I can tell you is the that if you are in such a situation is to not worry and go on, except in rare cases, for everyone I saw it happened, the event was finally for the best because the next step in their life was better in the end: better job, better salary, better project, being able to do what you always dreamed to like create a company or evolve your career.