Why can't I insert a keyframe into the prop from the operator panel?
The layout.prop that you're using is not in a Panel, but in the Operator dialog, which serves as an UI to an operation itself, and skips UI events that call for other operators (like the bound key to call 'anim.keyframe_insert', or to invoke another dialog for 'buttons.context_menu' that you mention)..
So if the function of the operator is to also insert a keyframe, you need to do that in the execution call.
import bpy

class MYPANEL_PT_Panel(bpy.types.Panel):
    
    bl_label = &quot;Test&quot;
    bl_idname = &quot;MYPANEL_PT_Panel&quot;
    bl_space_type = &quot;VIEW_3D&quot;
    bl_region_type = &quot;UI&quot;
    bl_category = &quot;Test&quot;
    
    def draw(self, context):
        
        layout = self.layout 
        layout.operator(&quot;mypanelop.test&quot;, text = &quot;Test&quot;)

class MYPANELOP_OT_Test(bpy.types.Operator):
    &quot;&quot;&quot; &quot;&quot;&quot;
    bl_idname = &quot;mypanelop.test&quot;
    bl_label = &quot;Test&quot;
    bl_options = {'INTERNAL'}
    
    def execute(self,context):
        # INSERTING KEYFRAME 
        context.object.keyframe_insert(data_path='location')
        return{'FINISHED'}

    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self,width=300)
        
    def draw(self, context):
        layout = self.layout
        ob = context.object
        if ob:
            layout.prop(ob,'location')
    

classes = (MYPANEL_PT_Panel, MYPANELOP_OT_Test)
    
def register():
    
    for cls in classes:
        bpy.utils.register_class(cls)
    
def unregister():
    
    for cls in classes:
        bpy.utils.unregister_class(cls)
    
if __name__ == &quot;__main__&quot;:
    register()