src: use function to get internal pointer

Remove the NODE_{WRAP,UNWRAP} macros and instead use template functions.