Oral vitamin D has been shown to be ineffective at this point, but this isn't surprising: it takes a long time of sustained oral supplementation to raise levels.
Then there's a whole lot of evidence showing correlation, but as you point out, low vitamin D is an indicator of frailty. This is much weaker evidence.
I think it's likely that taking oral vitamin D before infection probably improves outcomes somewhat.