Why is “get_template_directory_uri” pointing to child theme?

It’s very common for themes to enqueue their stylesheet like this:

wp_enqueue_style( 'notmytheme-style', get_stylesheet_uri() );

When you activate a child theme for a theme that does this, get_stylesheet_uri() becomes the child theme’s stylesheet URL. This means that the parent theme will enqueue the child theme’s stylesheet (with notmytheme-style as the ID), but not it’s own stylesheet.

That’s where this would be coming from:

<link rel="stylesheet" id='notmytheme-style-css'  href="http://localhost/mywp/wp-content/themes/notmytheme-child/style.css?ver=1.0.9" type="text/css" media="all" />

It’s the parent theme’s ID with the child theme’s URL.

The issue with your code is that you’re using the same handle (notmytheme-style) to enqueue the parent theme stylesheet as the parent theme is using the load the child theme’s stylesheet. When you do this it will be ignored and enqueue the first version defined. This is why changing the priority affected the result. Whichever notmytheme-style is defined first is loaded.

So the proper way to enqueue the CSS in this circumstance would be to not enqueue the child theme stylesheet, and enqueue the parent theme’s stylesheet with a different handle and higher priority (lower number):

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 9 );
function my_theme_enqueue_styles() {
    $parent_style="notmytheme-parent-style"; // New handle.

    wp_enqueue_style( $parent_style,
                        get_template_directory_uri() . '/style.css',
                        array(),
                        '1.0.9' );
}

This does mean that your child theme stylesheet will be using the version number of the parent theme. This could be avoided by instead dequeuing the parent theme’s original style and re-enqueuing it:

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 999 );
function my_theme_enqueue_styles() {
    $parent_style="notmytheme-style";

    wp_dequeue_style( $parent_style );
    wp_enqueue_style( $parent_style,
                        get_template_directory_uri() . '/style.css',
                        array(),
                        '1.0.9' );

    wp_enqueue_style( 'child-style',
                        get_stylesheet_directory_uri() . '/style.css',
                        array( $parent_style ),
                        '18.08.07',
                        'all' );
}