Why is the wtxid considered malleable since the transaction is unconfirmed? How can a third-party modify it?
All transaction data is committed to the WTXID, unlike in the case of TXID's.
Malleability is found in the unlocking script/data of a transaction. It is malleable, because is not committed to the signature (circular dependency).
Sources of TX Malleability:
- Signature Malleability
- Input Script Malleability
BIP62 for a great overview of TX malleability sources.
The unlocking script data is found in input scripts (non-witness tx's) and witnesses (witness tx's). For a witness transaction, if the witness is modified in a way that doesn't affect validity, this necessarily changes the resulting WTXID.
The TXID's of witness transactions are not malleable, because the input script is empty and witness data is stripped for its TXID derivation. Transactions are not referenced by WTXID, but by TXID's.
To add to James' answer, the "segregated" witness can be switched out for an alternative valid witness which changes the wtxid but not the txid. The txid stays the same if you change the witness as the witness is not hashed for the txid but is for wtxid.