Convert an already created custom content type into a new module
Use Features. It's main job is to export such configuration into code. While not primarily intended to be manipulated afterwards, it's definitely possible, as I've done so several times myself.

You can even add custom directly into the generated .module file and features will respect and keep that if you do further changes from the UI later.

This way you can keep using the UI to make most of the changes to the content type, yet keep custom logic in the same module.