I would never stop HRT for any surgery. It will slow recovery and has no negative effects on infection risk, etc. Decades ago John Lombardo was Browns team doc at the Cleveland Clinic, ended up NFL drug czar, etc. Anyway he told me, back in the day before drug testing, if the guys were on anything and needed surgery for injuries and for some reason couldn't get their gear, they would put them on testosterone bc they found recovery was slower without it. My ortho who is a former BB advocates GH, TRT and a little VAR for recovery from shoulder/knee surgeries etc. Also big on BP-157 and tesamorelin.
I swear I hear so many horror stories from people I know who have had hip or knee replacements. If I ever get told I need one I am going to be scared shitless.
We have a number of guys/gals at the gym that have had great results with hip, knee and shoulder replacements. The outcome depends on the surgeon, the OR, the post OP, and you, and then there is the "shit happens" factor (infection, DVT, etc.) that no one sees coming, but you can do your best to mitigate it.