I'd not dig too deep in this, unless you are interested in pulumi internals.
The main pulumi binary is written in Go and contains necessary logic. All language SDKs have some sort of bidings to the binary which executes your code.
if you are looking for more detailed answer I'd recommend reading pulumi code - it's an open source