I think the vast majority of binary trans people consider gender expression to be an integral part of gender identity, and at least a majority also consider HRT or surgery to be a significant component. I think there are close to 0 people walking around with a beard and wearing masculine suits that identify as transwomen.
Non-binary people are another discussion, and how they should fit into male/female spaces is of course unclear.
Overall, I would agree that prison assignment should depend on more than reported identity. Especially since it is conceivable that people in prison are likelier to lie about their internal identity if they believe they can get something out of this lie. This is much less relevant for lower risk environments, such as bathrooms (in my country at least, unisex bathrooms are anyway quite common) or gym lockers.
Non-binary people are another discussion, and how they should fit into male/female spaces is of course unclear.
Overall, I would agree that prison assignment should depend on more than reported identity. Especially since it is conceivable that people in prison are likelier to lie about their internal identity if they believe they can get something out of this lie. This is much less relevant for lower risk environments, such as bathrooms (in my country at least, unisex bathrooms are anyway quite common) or gym lockers.