The story is genuine. Isaacson retells it in his scientific biography Einstein: His Life and Universe based on recollections of his younger sister Maja, along with other evidence that dispels the early "Einstein was a slow starter and flanked school" story exaggerated by his parents:
"His uncle Jakob Einstein, the engineer, introduced him to the joys of algebra. "It's a merry science," he explained. "When the animal that we are hunting cannot be caught, we call it X temporarily and continue to hunt until it is bagged." He went on to give the boy even more difficult challenges, Maja recalled, "with good-natured doubts
about his ability to solve them." When Einstein triumphed, as he
invariably did, he "was overcome with great happiness and was already
then aware of the direction in which his talents were leading him."
Among the concepts that Uncle Jakob threw at him was the Pythagorean theorem (the square of the lengths of the legs of a right triangle add
up to the square of the length of the hypotenuse). "After much effort I
succeeded in 'proving' this theorem on the basis of the similarity of
triangles," Einstein recalled. Once again he was thinking in pictures.
"It seemed to me 'evident' that the relations of the sides of the
right-angled triangles would have to be completely determined by one of
the acute angles."
Galina Weinstein compiled a useful collection of sources on Einstein's early life in Albert Einstein: Rebellious Wunderkind, she cites Winteler-Einstein, 1924, CPAE, Vol. 1, p. xx, pp. 1xi-1xii as the source for Maja's recollections. They are (partly) confirmed by Einstein's own Autobiographical Notes, Reiser's 1930 biography, and a medical student Max Talmoud (later changed to Talmey), who dined with the family on Sabbaths and published his own Personal Recollections of Einstein's Boyhood and Youth (Scripta Mathematica, New York, 1932, Vol. 1, pp. 68-71). According to Talmey:
"Contrary to popular belief he [Albert] had an unusual predilection for mathematics, and because of this fact I gave him, after his promotion to the fourth grade, Spieker's textbook on geometry... I used to visit his home every week and whenever I came he delighted in showing me his solutions of new problems which he had found in the book [Spieker's geometry book …] and soon he had mastered the whole textbook. He then turned to higher mathematics [...]. His progress in mathematics was so rapid that very soon I was no longer a match for him in the subject."
Talmey also gave Einstein two books on physics, including Buchner's Force and Matter and Bernstein's illustrated series People's Books on Natural Science, "a work which I read with breathless attention", according to Einstein himself. It also came to light that the electrical engineering enterprise of uncle Jakob and his father Hermann played a part in fostering Einstein's later fascination with fundamental physics. NYT Sullivan's Einstein Revealed as Brilliant in Youth (1984) references Stachel, the Princeton University Press editor of Einstein's papers, and records acquired from Swiss archives:
"The more recent acquisitions also document, as never before, the scope of the electrical manufacturing activity of Einstein's father Hermann and of his more scientifically minded Uncle Jakob. It now appears that the Einstein enterprise was internationally recognized and considerably more innovative than previously suspected. Technical journals in Britain, France, Italy and Germany reveal that one of its devices, an electric meter, was patented in the United States, and that the Einstein company built the central power station for a Munich suburb... This has led Dr. Stachel to suspect that Einstein's upbringing in a home where manipulations of electricity and magnetism were a daily preoccupation helped set him on a road that led to his first relativity theory. The effect on the young Einstein, in his view, ''was much more significant than usually appreciated".