I cannot answer in full in just one comment, because in order to come to this, I went to this for a long time and managed to study a lot of things.
In short:
Yes, destiny is predetermined by us even before we incarnated in this world. We "thought out" in advance how to go through such an experience and such lessons in order to develop as much as possible, gain spiritual qualities and understanding. But in this material world it seems as if we ourselves make decisions and are the creators of fate. Therefore, if you yourself are the creators of your own destiny here in the material world, it was predestined. This understanding will help you if something bad happened (as it seems to you), because it should have been. Only your conclusions from these life lessons and the qualities that you will develop during your life depend on you. Therefore, just try to use your common sense and do everything that depends on you, entrust the rest to God/yourself/the Universe/fate/plan, etc.