Yes, it is actually necessary to derive your own GtkWidget and add the GtkPopover.
Here you can find an example of this:
https://stackoverflow.com/a/78803432/22768315
There is also a reference to further examples.
A more detailed explanation can be found here:
https://discourse.gnome.org/t/gtk4-gtkpopover-finalizing-warning/25881/3?u=holger
Have fun programming in the new year 2025.