Perturbative expansions from Monte Carlo simulations at weak coupling: Wilson loops and the static-quark self-energy