Retrieve all term IDs of post

Try out this code and see if it works for you, I just cooked it up real quick and haven’t tested it, so it may be way off base, but the concept is there.

$tax_args = array(
    'public' => true
);
$taxonomies = get_taxonomies( $tax_args, 'names', 'or' );

$term_args = array(
    'fields' => 'ids'
);
$terms = get_terms( $taxonomies, $term_args );

Docs: get_taxonomies(), get_terms()