My grandson is 5 and has been able to recognise the difference between girls and boys for a long time - and only wants to play with boys. If you told him one of the girls in his class is actually a boy he'd be totally bewildered.
To be honest if I had a 4 year boy who said "I'm a girl", I'd say "No you're not"
Bereavement wipes out everything
