Cavity-enhanced narrowband spectral filters using rare-earth ions doped in thin-film lithium niobate