Hermaphroditic reptiles can occur via axial bifurcation.
Axial bifurcation is a process in which an embryo splits along its axis early in its development. A complete split produces identical twins. A partial split results in a single individual with duplications.
Reptiles are more likely than mammals to undergo an axial bifurcation that produces a live individual; two headed snakes and turtles are rare but much more common than mammals with this condition.
I figured if a reptile could undergo axial bifurcation and have two heads, why not two sets of genitals? This would be less spectacular and more likely to evade notice, but case have been described. Described here are turtles from an article on axial bifurcation and teratology.
The Principal Diseases of Lower Vertebrates
Hermaphroditic sexual organs are of more obvious teratological
interest. Risley (1941) reported on a specimen of Chrysemys picta
marginata Agassiz which proved to be a complete hermaphrodite equipped
with two testicles, a well-developed left oviduct, and nine oocytes in
the right and thirty-two in the left testis. Another turtle
(Mal.aelemys terrapin centrata Latreille) showed some degree of female
pseudohermaphroditism. The juvenile animal was equipped with ovaries
and an ovarian medullary tumour composed of testicular tissue.
This would also be a mechanism for a dragon to have 6 legs. I think it would necessarily have 2 tails as well.
The OP also wanted an individual which could fertilize itself. For a reptile such as is described here, the mechanics involved in that might be an obstacle.