Anyone can build muscle/lose fat over time, it's called recomping. It's just that this is a very fast process for beginners, and significantly slows down for more intermediate/advanced athletes.
Firstly, it's not a biological process that only fires up when you're a beginner and then shuts off at some arbitrary point. Muscle building and fat burning happens along a continuum. Your body is continuously breaking down fat and building up new muscle at all times (and also storing new fat, and breaking down muscle). All training/recovery does is induce signals that adjust the rate of each of these processes.
Think of them as a continual, random biological processes.
Of course, the optimal conditions for muscle growth include a caloric surplus. Similarly, the optimal conditions for fat loss include a caloric deficit. But all this ("optimal") does in reality is make the signals to do either process stronger. But you can still perform both muscle building and fat loss even if it's not optimal.
When you're a beginner (you don't have much muscle/you have significant fat) these equations are more favourable (for muscle growth and fat loss). As you get more advanced (approach your muscle limit) these equations reduce in magnitude of effect and you can no longer to any meaningful degree (compared to what could be achieved through dedicated cut/bulk cycles) do both at the same time.
Why is it fast in beginners?
Everything is faster as a beginner. Your body reacts to a stimulus very rapidly the first time it experiences it. However the reaction slows down every time the stimulus is repeated. Your body actually works to ensure the response is lesser over time. Sucks but that's life.
The important bit is that this happens over a continuum and you don't suddenly switch from beginner to nonbeginner all of a sudden.
Note on common perceptions of "noob gains"
For marketing reasons, it's beneficial to sell consumers this idea of a "magical" beginner phase that you have to take advantage of or you will lose it. Some well known programs in fact work on this premise, twisting expectations with half-truths so that an uninformed consumer would begin to think that they have to train a certain perfect way as a beginner or they lose a huge opportunity. Of course such programs/diets/coaches will then offer you their expertise to tell you exactly how you should be training. This normally involves some sort of payment/book purchase/etc.
The reality is there is no magical beginner phase, and you can't waste it. The closer you are to your genetic potential the slower progress is, the further away from it you are the faster progress is. Training is simple, ignore the hype.
Why don't people just recomp all the time then?
Because of how fast (or slow) it produces gains. After a certain point of advancement, even though you are still building muscle/losing fat, the rate at which it happens is just slow. In such situations people wanting maximum progress switch to bulk/cut cycles because they can overall make gains faster like that.
You can try to achieve multiple contradicting goals and do each of them to a mediocre level, or you can focus on one goal at a time and master it.