Well, she was already upper echelon in the Canterlot aristocracy - personally tutored by the ruling Princess, brother captain of the Royal Guard, foalsat by another Princess and now that same Princess is her sister-in-law
Yep, she's a magical unicorn princess
The tutoring could be explained by talent. The latter part, not so much.
Twilight's place in society prior to her being selected has been left undefined, though she at least got some parents out of her flashback.
She did live in Canterlot, which we've seen referred to as being a place that has a reputation for being refined and cultured, and in other episodes we see it has a lot of the upper crust there.
That doesn't mean Twilight's family was one of those elite, as the depiction in "The Cutie Mark Chronicles" showed many apparently average festival goers. That episode avoided the more classist subtext that popped up at the Gala and smacked Rarity across the face in "Sweet and Elite", but if we were to extrapolate a bit from other cases of getting into an elite school, that could imply they weren't lower-class.
One possible writing slip-up in the flashback was that Celestia knew Twilight's name when she stopped her rampage. If that were accepted as being intended, that meant Twilight's family moved in higher circles even prior to her being taken under Celestia's wing.
The Canterlot wedding episode and the decision to make Cadance an alicorn and a princess had a constricting effect on the world setting by putting Twilight in contact with royalty at the very outset, prior to showing a talent in magic. Are we to expect that just anyone could have foalsitter from a few branches to the side of the monarch?
Given Twilight's social obliviousness, she might not have thought overmuch about her place in the strata of Canterlot, a rarified setting that has been explicitly more class-based than anywhere else.
Even the richest of the Rich family in Ponyville fit in with the struggling farmers, his spoiled daughter being the exception.