Simple PHP Class Autoloader for a WordPress plugin without using Composer

So I set up an autoloader in PHP using spl_autoload_register() (and not composer).

I have made my custom plugin called my-plugin, refer to the attachment for reference of folder structure.

I have learned to include files like autoloader or trait-singleton.php, I need to include it in my main plugin file i.e., in my case my-plugin.php.

Now when I try to error_log() the parameter spl_autoload_register() accepts, I get a completely different thing.

<?php
spl_autoload_register( function ( $class_name ) {
    error_log("Autoloader received: " . $class_name);
    include $class_name . '.php';
}

[14-Feb-2025 00:08:23 UTC] Autoloader received: WP_Site_Health

I am unable to complete the autoloader function, the singleton file works great when i include it in the main plugin file.

How do I implement autoloader for my particular file structure, where most of my files would be located in my-pluginincclassespost-types for CPT and my-pluginincclassestaxonomies for taxonomies.