How to restrict Hooks On a Doctype if called from another Doctype?

I have a DocType ‘User’ for which I have created some hooks in hooks.py file. So whenever the input fields are filled and submitted for that doctype some hooks are called.
Now here’s the thing I have created another hook for User Doctype in another Doctype ‘Organization’ too. And whenever Organization gets created the hooks for Users defined in Organization Class are called. Which also triggers the hooks present in hooks.py for User Doctype. I want to restrict that.
So what I want to achieve is when I am creating an Organization the hooks for User gets called but no further hooks get called. How do I achieve that? How do I restrict the

Hooks defined in the hooks.py.

"User": {
	"after_insert": [
		"core.api.add_user_to_db",
		"core.identity.doctype.employee_profile.employee_profile.add_employee"
	],
	"on_update": "core.api.update_volunteer"
},

Organization.py

class Organization(Document):
def after_insert(self):
	frappe.logger().debug("Adding User")

	user_profile = frappe.get_doc({
		"doctype":"User",
		"email":"asdfghj@gmail.com",
		"first_name":"asdfghj",
	})

	user_profile.save(ignore_permissions=True)

Did you find solution ?