Hi — I’m going to respond from my own perspective as a non-binary trans-masculine person.
When I was born down to my parts I was seen as female. I was raised socially as a female, knowing something wasn’t right — even though I lived as a tomboy. I believe this is known as “the egg” stage. I didn’t know the words for this wrongness I felt just that I felt like I was wearing a mask every day and it was exhausting and that wasn’t right.
When I talked about all this to my GP I was referred to gender clinic.
All this time i was “male” (well non-binary) but I hadn’t known until I discovered for myself and talked to health professionals.
I believe what your getting confused over is the biology (in scientific circles referred to as “sex”) and gender (which is starting to be viewed as the social constructs). I don’t know if this explanation helps but I hope it provides insight