It would be naive to expect any extended fat loss phase to not result in some degree of muscle loss. Likewise, it would also be naive to think you can gain any considerable amount of muscle mass without gaining some body fat, with the caveat you’re not a beginner, you’re returning from a lay-off, or you are using drugs.
These are three examples when a re-comp can happen (fat loss and muscle growth simultaneously), this also usually happens by default for any very overweight individuals being introduced to resistance training.
Back to the point… be realistic with your expectations, give yourself plenty of time and expect some degree of muscle loss during an extended fat loss phase, likewise some fat gain during an extended muscle building phase.
Focus on minimising the above negatives, but realise a little bit is okay.