I would say that your own answer might be a good start. Still, I would do it a bit differently. So, here are a few suggestions/additions.
1) You could first determine the possible positions of doors in each room, then use those as joint points. You connect Room A to Room B by a given door of A to a given door of B and then test if the result meets your conditions (for instance, that there is no overlap between the interior of the rooms, etc). This way can be cheaper than walking each room against each other.
2) If rooms are irregular but never super very complex in shape (like the simple shapes of T, L, U, E, squared, rectangles, etc) AND if you want perfect fit between rooms, you can use rooms vertices as point-joints for checking. It means, you choose a vector from room A boundary and make it match a vector of room B. Like you can see in figure below, you have to make sure at least one edge overlaps, so to avoid the first case shown. Also, you have to make sure that only edges overlap, i.e. no interior area, so to avoid the second case shown. So either the third or the fourth cases shown would be accepted and rooms would them be connected:

3) No matter the solution (including your own), depending on your preferences, you might want to try to leave as least open spaces as possible without rooms. For instance, in your example, it would mean starting the test for the position of room A in the empty space of the bounding box of B. One way to do that could be by identifying the vertices/edges/doors/whatever of B that lay within the base polygon of the bonding box of B, not at its edges. And then start there.
With some approaches, like the one shown in the figure above, i.e. using vertices as joint points, you can also find such specific match by doing the following. If you discard the cases where inner areas overlap, and only accept the cases where at least two edges overlap, then you can only have the last case shown in the figure.
4) If you choose to position the rooms near to each other and then walk one against the other testing for collisions, the first thing you should do is place both rooms near each other but in a way that they do not overlap, before moving one against the other. Doing that you save performance since you will need to move them less and also perform less collision checks. The best way to do that (specially if you have a big scene) is with spatial partitioning.
5) With any of solutions above, if you have really very complexly shaped rooms, one possibility is the following. If you don't mind using an additional mini-polygon as a corridor, just place the rooms very close to each other but not colliding (e.g. via spatial partitioning + walking one room), and then place the small corridor between then (even if it overlaps a bit) and use the common area between them as the passage:

Hope it helps, at least as food for thought.