Step 1.
To get the indexes of the reference planes you need to create an instance of the family in a project file and manually add a dimension to them using the UI.
You then need to write an API command that can read out the actual references that the dimension is attached to. Dump these out as text using Reference.ConvertToStableRepresentation().
You'll get something that looks like:
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:2:SURFACE
The last digit (2) is the reference index (or id? not sure I'm just making this stuff up as I go). This is what you will need to record so that you can use it later.
Step 2.
Now, use this information to add a dimension / alignment to this reference using the API, you will need to take an instance of the family and extract some geometric faces. Be sure to set compute references in your geometry options and use GetSymbolGeometry while extracting.
Once you have a face, dump out it's reference using Reference.ConvertToStableRepresentation(). Take the reference string and substitute in the index number you found earlier. You can now build a reference using Reference.ParseFromStableRepresentation() which can be used to add a new dimension.
Done.
For any particular family you should only have to do the 1st manual step of extracting the index once and it will hold stable for any instance of that family. This hasn't been extensively tested so keep an eye on it, I am unsure whether minor mods to a family change the index values, but I'm sure that if someone were to delete the reference plane from the family and insert another in its place, the index would become invalid.
The second step can be automated, but I'm sure there will be a few gotcha's in there somewhere for nested and otherwise complex families.
Revit API programming, gotta love it sometimes 🙂