How is this checkmate?


Pinned pieces still protect/attack squares they could normally move to if not pinned. A king can never move into an attacked square and a player can never move a piece that would expose their king to check
As you mention, if that was possible, and one player could expose their king, the other player would be allowed to as well and would take the opposing king, ending the game.