I'd like to place variable number of additional nodes on the border of the rectangle. I suggest it to look in a somewhat following way:
\node[name=R, my rectangle=top:3 bottom:1 left:2 right:1] {Node R};
or even better:
\node[my rectangle=top:3 bottom:1 left:2 right:1] (R) {Node R};
As nodes are not parts of the path and are stored for execution at the end of path construction, both cases should be equivalent. Anyway, this node definition should result in implicit defining of nodes/coordinates named, respectively: R top 1, ..., R top 3, R bottom 1, R left 1, R left 2, R right 1.
Having looked into pgfmanual I found there a key /tikz/name, but failed in accessing it's value from my rectangle/.code.