Agree with “just leave the sensor connected”. There’s no need to remove it.
I got three of the nylon pins back in and the *last one* snapped part of the split end off. I just want to add a “me too” to the M3x20 nylon screw and hex nut solution. Re-use the spring and tighten to the same length as the original pins and you should be good to go. I did all four so I don’t have to re-live that ever again.
If you’re swapping top cases, you might need to remove the battery indicator from the case and swap it to the replacement top case. It attaches with three very tiny Phillips screws. I wasn’t aware that my replacement top case didn’t have this part and got confused when reversing the steps to reassemble and I didn’t have this connector. I had to take the battery back out in order to swap the indicator over.