When joining objects, can blender make a vertex group which contains the vertices of each object that was joined? I wanted to know if it was possible, natively or with an addon, to make Blender auto create vertex groups when joining objects, by making each joined object a vertex group?
A concrete example:

I have a cube and a sphere.
I join them.
After joining them the new object has two vertex groups:
one contains all vertices from the cube, the other all vertices from the sphere.

Is this a possible thing or do I need to manually make my groups before joining?
Pre-op script
Testing shows that uniquely named vertex groups are retained when joining mesh objects.  Instead of doing this manually (boring) can speed it up with a script.
Running script below will give each mesh object in selected objects a vertex group named after the object containing all verts with weight set to 1.
Have commented out the join operator, uncommenting will do it all in one, by running script when selection matches that for join. (ie adds selected to active)
import bpy

context = bpy.context

obs = [o for o in context.selected_objects if o.type == 'MESH']

for o in obs:
    vg = o.vertex_groups.new(name=o.name)
    vg.add(range(len(o.data.vertices)), 1.0, 'REPLACE')
    
# run the operator    
#bpy.ops.object.join()

It occurs that as well as adding vert group, renaming existing groups by for example prefixing object name would stop groups of same name merging
Add this in loop before making new group.
for vg in o.vertex_groups:
    vg.name = f&quot;{o.name}_{vg.name}&quot;

Deja Vu
Creating a batch version of a script that renames Vertex Groups