YEs, the common approach is to create prefabs/template following some convention (e.g. gui template with node for a background of button, text node, etc) and creating them in code.
Good example of such approach is Druid:
It has a button component already and it is a good approach to make it reusable (in OOP way), by using proper templates and defining “on_click” functions for each button.