Use BUILD* deprecation wrapper for virtual method

This took me hours to debug, because it caused pretty random behavior.

Distros should ideally backport this, since it will cause issues for consumers that want to disable deprecations.

BUG: 448680
(cherry picked from commit 765ab0f3)
3 jobs for v5.90.1 in 1 minute and 52 seconds (queued for 3 seconds)