Hi Tobias,
(Sort of a shameless plug)
In the past few years I have been working on HAROS, a framework for static analysis of ROS systems, as part of my PhD thesis. As of version 3.0, it is able to extract an architectural model of the system by parsing the source code (as if compiling it).
This extraction process is not perfect nor complete, but it should handle many common cases in C++, and I’ve had external help in implementing a Python equivalent (still under evaluation).
It should be possible to use HAROS for the kind of checks that you seek (i.e., “is my implementation compliant with the architecture I want?”), with the advantage that the feedback is returned without running the system.
Of course, coupling this with runtime tools, such as you mention, further boosts your confidence in the implemented product.