Ludwig IX, Adipati Bayern