I think it's supposed to be used for meta-transactions. You can find similar examples that OpenZeppelin implemented that was also designed to be used this way.
To support native meta transaction, OpenSea inherits
NativeMetaTransaction contract that execute another function on itself (on behalf of the user with a signature), which will make the
msg.sender its own address (
(Read this if you don't understand why msg.sender can be the contract address itself: How can msg.sender == address(this)? )
In OpenSea's case, the meta transaction is executed by the function
executeMetaTransaction here, which put the user's address as the first argument. So the
_msgSender() function is basically just saying, if this is a meta transaction, use the original signer's (user) address as the message sender, which can be found by parsing
This is how they can support some gas-less transactions, where you just need to sign a signature and the opensea proxy will pay gas for you, while the contract will just works as you're interacting with it directly, without introducing additional roles in the contracts.