Create content after editing other content-type
How can I find out the ID of the content-type A node?

You should use devel module's kint function to get all available methods of an object, and you could easy find out, that it's: $node_object->id();

how can I find out if a B-type content already exists referencing the A-type node I'm working with?

You will write a Database service query (not pure sql query), where you will have two important condition:


the node type must be B 
it's reference field contains the id of the A content.


You will of course have to use table joins. To better understand the schema representation of your content types, I suggest you do use phpmyadmin parallel.