When I was coaching in St-Louis (official training center for the Blues) one of my clients had a complete hip replacement. We never did any “fixed” multi-joints lower body exercises and he went on to become fully functional again. While I’m not an injury specialist, I can offer my two cents.
While the Smith machine might look like the safer option, and it might be in the VERY short term, it is not the right or even the safest option.
It can give you the illusion of safety but in reality it can be worse. Because you don’t develop the same body control and stabilization as you would with a free-weight movement.
Another point is that if you have slight movement imbalances, for example shifting a bit more on one side (which is bound to happen with a hip replacement, at first) or rotating the pelvis, the Smith machine will actually put the body under more torque; the reason is that both ends of the system are fixed (feet on the floor, fixed bar on the shoulders) since neither end can rotate to accomodate the torque, it’s the body that will absorb all the force, specifically the knees, hips and lower back area. This could lead to overuse issues quickly, in your situation.
With a free weight movement, we still want to avoid imbalances and torquing, but if it happens it’s not as dangerous as the torque is partly reduced through movement.
Finally, the Smith machine is more problematic for the main reason why it seems appealing: it. will get you back to squatting heavier, sooner.
Why is that a problem? Because it will get you squatting on a full range with significant loading before your body is ready for it. When you can do a proper back squat with free weights and without pain or discomfort, you know that your body is ready to go. But Smith gives a false sense of readiness that can lead to injuries.
When you have the choice, when the goal (in part) is to re-establish your capacity to move well, free-weights will always be superior to the Smith machine.
Now the thing will be to establish a gradual progression toward squatting and deadlifting again (I personally would use the Romanian deadlift and eventually pin pulls below the knees, not full deadlifts from the floor).
That will require unilateral work to balance out both sides. Lots of glutes work to be better at creating active hip stability and a very gradual introduction of the big basics, ideally with progressive increase in the range of motion THEN of load.
For a few months, do not see squats and hip hinges/deadlifts as movements to gain strength and size, see them as motor skills you want to acquire.
You will no get injured by doing a free-weight exercise with good mechanics and within your movement and loading capacities. You get injured when you use improper mechanics and a load that is excessive for what you can properly handle at the moment.
This can happen with any training tool, but the Smith machine can make it more likely by giving a false sense of confidence and the illusion that you can handle more than you really can at that moment in your recovery process.