This question is 40-50% linguistic and 50-60% non-linguistic. Without a proper understanding of both, it would be impossible to really appreciate this sentence on any meaningful level.
First, let us look at the linguistic side of the question just because that is what this place is mostly about.
「Noun + が + Same Noun + (である/だ, etc.)」
means:
"[Noun] being what it is", "[Noun] being the kind of [Noun] that it is", etc.
Note that this 「が」 cannot ever be replaced by 「は」 because it is a fixed expression.
This is a way of emphasizing the unique quality or characteristic of the object in question without explicitly mentioning that quality or characteristic . This is why I call this question "at least 50% non-linguistic". In this case, you have to know as prior knowledge how expensive this 「学校」 is. I will come back to this later.
「学校が学校なのと年が年なので」
therefore, means:
"because of the/our school being what it is and his/our age being what it is"
So, it is implicitly saying that the school was very expensive and his friend was very young.
The school in question is said to be 東京帝国大学{とうきょうていこくだいがく}, which is now called 東京大学. The period setting is at the end of Meiji Era. Even though it was a public school, the yearly tuitions at that school were as high as a working man's salary for several months. This is why the living standard of the narrator's friend was not very high even though he was from a rather wealthy family.
"which shows that "A が A" means something along the lines of "regarding A". Am I wrong?"
Sorry but I have no idea how you got that idea. "regarding A" is a little too weak as a translation.
I wonder if there are any rules or restrictions in using this pattern, as well as any possible indications and nuances.
To use 「A が A」 correctly, one must assume that the listener/reader has a general idea of what quality about A one is referring to. Otherwise, it just will not work well as that quality will not be explicitly mentioned (unless asked about later).
Example:
A:「やっぱりアキラ君{くん}、背{せ}が高{たか}いよね~!」
B:「そう、お父{とう}さんがお父さんだもん。」← That Akira is tall because his father is tall is implied. B knows that A also knows that Akira's father is tall.
Another:
A:「林{はやし}さん、ボーナス200万円{まんえん}だって!」
B:「すごいわよね。勤{つと}めてる会社{かいしゃ}が会社だものね。」 ← That Hayashi's company pays well is implied. B knows already that A also knows well about that characteristic regarding Hayashi's company.