Correlation of molecular valence‐ and K‐shell photoionization resonances with bond lengths