If you're putting on a lot of muscle then there's a good chance you're burning a lot of fat. Muscle, of course, is much denser so you could actually be gaining weight while shrinking your waistline. As you say, there are lots of variables in that process. For someone who is not involved in a lot of lifting, there should be no plateau as long as you continue to burn more calories than you consume. Eventually though, once your body fat is low, you will need to balance your calorie consumption with the amount of exercise or you could do some serious damage to your body.
For someone doing eat less exercise more there should always be some lifting, it’s good to try to add a little muscle during your weight loss. For one thing it helps make sure you’re not burning muscle (one of the many bad side effects of going into starvation mode), also muscle burns calories in just being so adding a couple pounds of muscle helps the overall calorie balance. And of course even if you’re not lifting cardio builds muscles too.
Yeah the end portion is difficult. Optimally what a person wants to do is scale their diet to the point where without their “extra” exercise they’re neither gaining nor losing weight, it’s the extra calorie burn that burns the weight. So then when they hit their target weight they can just scroll back the exercise. It’s a hard balance to strike though, but it’s all hard, and in the end worth it.