HOWTO: override component templates programmatically?

Just place the new template in the templates folder of your theme/theme-component.
Use the resolver to find the template. Something like below in init or didReceiveAttrs callback(doesn’t work on callbacks after these two). Set the component’s layout property as the custom template.

@on('init')
overrideTemplate(){
  const template = getOwner(this).lookup(`template:your-template-filename`);
  this.set('layout', template);
}

Notes: