Is possible to generate a preview material from python?
BlenderKit has a built in thumbnail renderer that does a pretty decent job, and the operator can be used quite easily in your custom script. The disadvantage of it might be the speed, since it renders a full cycles scene, unlike the preview that has obviously many optimisations and renders instantly.