Understanding __self in UUPS

  modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");

This is from the UUPS contract, here is the link

How is the second require statement true? My understanding currently is:
Since this call is done via delegate call, __self would be 0 in the proxy contracts storage but this isn't the case since it is the implementation address, how is this possible?

I know it's late, but I was wondering the same thing. After some digging I found out the following:

The reason this works is because __self is immutable. When the implementation contract is constructed, all usages of __self in the code are directly replaced with its value. Thus, __self is not actually read from storage, so even when a function of the implementation is called in the context of the proxy, __self stands for the address of the implementation contract.