Bourbon, by legal definition is aged in a fresh oak barrel. The oak heartwood naturally contains aromatic compounds including (you guessed it) vanillin—the primary flavor component of vanilla itself.
But beyond the already-present aromatics, the wood is further treated to produce even more flavor. About 20% of the oak's mass is made of lignins. When exposed to temperatures of 750° F the lignin breaks down to more aromatics including, once again, vanillin. Your bourbon barrel is charred in an open gas burner for 15—45 seconds, making these flavors ready for extraction into your bourbon. The alcohol will then be able to further break down some of the solid mass and dissolve the aromatics.
So bourbon is a good vanilla substitute because of the relatively high portion of vanillin that it contains