Random core dumps and segmentation fault

Might be the case, but I would start by trying to isolate a particular software setup which might be causing this issue.
E.g. could you run the same workload in an Ubuntu18.04 docker container and check, if the behavior stays the same?
If so, could you run it with:

gdb --args python script.py args
run
...
bt

and post the backtrace here?