Are you aware of anything that does that and that we could call? I think that setup with absent homedir && non-configured pam_mkhomedir is broken anyway and one can only fail gracefully with a good error message. Other variants (homedir already exists and/or pam_mkhomedir is configured) can be covered by calling
su' or
sudo' with appropriate options (e.g. su -c /bin/true "${user_to_add}"). This would fail if homedir (either existing or not) is located on a network or encrypted FS (where local root can't do anything without knowing user's password) but this is a separate issue.
I've also seen posts (e.g.[1]) about `oddjob-mkhomedir' (and I've already seen it in Debian repos) but I wonder if this way is production-ready. And this way seems to be more complex.