For what it's worth, I've found that I almost always want to put the label tag after the input tag. That enables me to select and style the label based on the input state via CSS pseudoclasses.
One more hack created by the lack of the :has selector. And yet browsers won't prioritize it.
safari and chrome have had :has() for a while, but it's behind a flag in firefox. the firefox version is good enough that i wish they'd unflag it already (as in, it's good enough to handle this particular input/label issue for instance, but not really complex selector combinations and edge cases).