I think class presence should be checked on autoconfigure includes.
With Spring Boot 4.0.2, using WebMvcTest with just spring-boot-starter-webmvc and spring-boot-starter-test-classic as dependencies result in :
java.lang.IllegalArgumentException: Failed to load include 'org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer' declared in jar:file:[...]/spring-boot-security-test-4.0.2.jar!/META-INF/spring/org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest.includes[...]
Here a sample application that reproduces the problem.