In order to get an LWGEOM from PostGIS you'll need to convert from the serialized form (GSERIALIZED) which you can read all about in the liblwgeom.h header. You'll be adding a hard dependency of course, but hopefully you're OK with that.
If you're just hoping to build a compound type, as your example shows, you can do that without a C extension, just read up on CREATE TYPE.
For an alternate example of an extension with a lighter dependency on PostGIS, check out pgpointcloud, which has it's own structure for spatial data (a point patch) and exchanges data with PostGIS via well-known-binary. This removes the liblwgeom dependency, which means it's possible to compile and use pgpointcloud without PostGIS installed, which is not entirely uncommon.
P