How to export Python animation to gltf from Blender 2.80?
The glTF exporter is looking for animation keyframes in the NLA tracks for export.  If you have custom Python code that's just writing to the object transform on the fly, that's not going to be found by the exporter.  Your Python code will need to create actual animation keyframes, such that the exporter can read those keyframes and write them into the glTF file.