How to stop WordPress from completely overriding my tags in my templates?

So after checking your search.php template, actually the issue is not with WordPress. Instead:

That the_post_thumbnail() (as in if ( the_post_thumbnail() )) echoes the post thumbnail and returns nothing which then bypasses your conditional (doesn’t echo your img tag), so you should instead use has_post_thumbnail():

if ( has_post_thumbnail() ) {
    // echo your img
}