for me, it’s pretty confusing in quite a few instances, but, just to give an example: if the striker shoots and the keeper saves it, but the striker taps in the rebound, how is xG counted? is it counted twice or just once? or, what if neither shot goes in?
Player position and defender position is factored in. The other intricacies you mention are why xG is not a suitable metric for the accurate depiction of a single game or even several games.
Rather, it’s far more suited for analysing performance over tens of games or entire seasons and can help to highlight problems in chance creation, finishing, or with specific players etc.