Improving Factuality in LLMs via Inference-Time Knowledge Graph Construction