How to identify a paragraph?
You probably should look at the paragraphs module code, it does a lot of this.

That said, the basic process would probably be:


Identify the form fields that are entity_reference_revision fields.
Check that the field is limited to paragraph types (can just check
1st one).
If it is an update form, get the referenced entities from the field.
You will then need some recursive code to walk the paragraph tree to
get sub paragraphs.


This will require using a lot of the field definition classes to get the information needed.