You are correct to suspect that prevalence of a disease is sometimes estimated from test results.
Denote prevalence $\pi = P(D),$ sensitivity $\eta = P(+|D),$ specificity $\theta = P(-|D^c),$ and the probability of a positive test in the population as $\tau = P(+).$ Then $$\tau = \pi\eta + (1-\pi)(1-\eta).$$$$\tau = \pi\eta + (1-\pi)(1-\theta).$$ Upon solving for $\pi,$ this implies $$\pi = \frac{\tau+\theta -1}{\eta+\theta - 1}.$$ So if you get the proportion $t = a/n$ of positive tests among $n$ randomly selected members of the population, you can estimate $\tau$ by $t$ and $\pi$ by $$p = \frac{t+\theta -1}{\eta+\theta - 1}.$$
If you want a confidence interval for $\pi,$ begin by getting the usual binomial confidence interval for $\tau$ and then use the second displayed equation on the endpoints of the CI for $\tau$ to get endpoints of a CI for $\pi.$
Note: Unfortunately, for tests with poor sensitivity or specificity or for prevalence $\pi$ near to $0$ or $1,$ the CI for $\pi$ can have nonsensical endpoints outside of $(0,1).$ Then a Gibbs sampler may provide a useful Bayesian probability interval for the prevalence $\pi$ of the disease.