For taking the size of the x-axis text from the theme is pretty straightforward.
library(ggplot2)
my_theme <- theme_light(base_size = 10)
calc_element("axis.text.x.bottom", my_theme)$size
#> [1] 8
For extracting this from a plot, you'd need to build the plot first. If you want to reliably replicate the theme settings used during drawing the plot, you'd need to complete the theme using an internal function (which I generally don't recommend, but point out nonetheless).
my_plot <- ggplot(mtcars, aes(disp, mpg)) +
geom_point() +
theme(text = element_text(size = 20))
calc_element(
"axis.text.x.bottom",
ggplot2:::plot_theme(ggplot_build(my_plot)$plot)
)$size
#> [1] 16
Created on 2023-08-30 with reprex v2.0.2