How to build (from scratch) a GFCI Circuit?
in principal, it can be a high ratio current transformer directly connected to a solenoid that breaks the circuit.  Especially in early designs, electronics are often avoided and simplified in circuit interrupting devices.  They are designed in as many ways as possible to fail safe, and this is part of the reason a mechanical switch is used.  

This is another in depth teardown of a european design.

If you're going to try to build or design a GFCI circuit from scratch for your own interest or education, fine, it's a very interesting device.  On the other hand if you want a device on which human safety will depend, buy one that is appropriately rated and certified in the region you live.