How can I get the names of the vertex groups these vertices are in?
There's no need for operators, nor the bmesh module:

import bpy

ob = bpy.context.object
assert ob is not None and ob.type == 'MESH', "active object invalid"

# ensure we got the latest assignments and weights
ob.update_from_editmode()
me = ob.data

# create vertex group lookup dictionary for names
vgroup_names = {vgroup.index: vgroup.name for vgroup in ob.vertex_groups}

# create dictionary of vertex group assignments per vertex
vgroups = {v.index: [vgroup_names[g.group] for g in v.groups] for v in me.vertices}

# test: print list of vertex group names vertex 0 is in
print(vgroups[0])